From 321147cac4ad56c905e70159fc1be933ec81f426 Mon Sep 17 00:00:00 2001 From: Remi Rampin Date: Tue, 28 May 2024 21:30:15 -0400 Subject: [PATCH] Start version control --- emscripten-rust | 17 +++++++++ emscripten-rust-sdl | 7 ++++ gnunet-0.14.0 | 18 ++++++++++ grafana.sh | 32 +++++++++++++++++ list-build-files | 4 +++ networking | 19 ++++++++++ nginx-rtmp/Dockerfile | 21 +++++++++++ nginx-rtmp/nginx.conf | 82 +++++++++++++++++++++++++++++++++++++++++++ restic | 17 +++++++++ restic-psql | 17 +++++++++ restic-server | 18 ++++++++++ rust | 16 +++++++++ rust-cargo-web | 21 +++++++++++ 13 files changed, 289 insertions(+) create mode 100644 emscripten-rust create mode 100644 emscripten-rust-sdl create mode 100644 gnunet-0.14.0 create mode 100755 grafana.sh create mode 100644 list-build-files create mode 100644 networking create mode 100644 nginx-rtmp/Dockerfile create mode 100644 nginx-rtmp/nginx.conf create mode 100644 restic create mode 100644 restic-psql create mode 100644 restic-server create mode 100644 rust create mode 100644 rust-cargo-web diff --git a/emscripten-rust b/emscripten-rust new file mode 100644 index 0000000..c44b32b --- /dev/null +++ b/emscripten-rust @@ -0,0 +1,17 @@ +FROM trzeci/emscripten:sdk-tag-1.38.41-64bit + +# Install Rust +ENV RUST_VERSION=1.38.0 +RUN curl -Lo rustup.sh https://sh.rustup.rs && \ + sh rustup.sh --default-toolchain $RUST_VERSION --no-modify-path -y && \ + rm rustup.sh +ENV PATH="$PATH:/root/.cargo/bin" + +# Add emscripten target +RUN rustup target add asmjs-unknown-emscripten --toolchain $RUST_VERSION && \ + rustup target add wasm32-unknown-emscripten --toolchain $RUST_VERSION + +# Reset entrypoint (avoid emscripten overwriting PATH) +ENTRYPOINT [] + +CMD ["cargo", "build", "--release", "--target=asmjs-unknown-emscripten"] diff --git a/emscripten-rust-sdl b/emscripten-rust-sdl new file mode 100644 index 0000000..dc5b251 --- /dev/null +++ b/emscripten-rust-sdl @@ -0,0 +1,7 @@ +FROM remram/emscripten-rust + +# Install libsdl +RUN apt-get update && apt-get install -y libsdl2-dev && rm -rf /var/lib/apt/lists/* + +# Build port +RUN echo 'int main() {}' >/helloworld.c && emcc -s USE_SDL=2 -o /helloworld /helloworld.c && rm /helloworld.c /helloworld diff --git a/gnunet-0.14.0 b/gnunet-0.14.0 new file mode 100644 index 0000000..08aa4f0 --- /dev/null +++ b/gnunet-0.14.0 @@ -0,0 +1,18 @@ +FROM ubuntu:20.04 + +RUN apt-get update -yy && \ + DEBIAN_FRONTEND=noninteractive apt-get install -yy autoconf automake gettext libgnutls28-dev make libtool libgcrypt20-dev libidn2-dev libmicrohttpd-dev libunistring-dev libgmp3-dev libcurl4-gnutls-dev libsodium-dev zlib1g-dev pkg-config libsqlite3-dev libjansson-dev && \ + apt-get clean -yy + +RUN useradd --system --home-dir /var/lib/gnunet --create-home gnunet && \ + groupadd gnunetdns + +ENV GNUNET_VERSION 0.14.0 + +RUN cd /usr/src && curl -LO https://ftpmirror.gnu.org/gnu/gnunet/gnunet-$GNUNET_VERSION.tar.gz && tar zxf gnunet-$GNUNET_VERSION.tar.gz && rm gnunet-$GNUNET_VERSION.tar.gz +RUN cd /usr/src/gnunet-$GNUNET_VERSION && \ + ./configure --disable-documentation --prefix=/usr --with-libidn2 --with-microhttpd --with-sqlite --with-zlib && \ + make -j6 && \ + make install && \ + cp /usr/src/gnunet-$GNUNET_VERSION/src/gns/nss/.libs/* /usr/lib/x86_64-linux-gnu/ +RUN cp /etc/nsswitch.conf /tmp/nsswitch.conf && sed '/^hosts:/s/ files / files gns [NOTFOUND=return] /' /etc/nsswitch.conf && rm /tmp/nsswitch.conf diff --git a/grafana.sh b/grafana.sh new file mode 100755 index 0000000..c07e918 --- /dev/null +++ b/grafana.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +set -eu + +if [ "$#" != 1 ]; then + printf 'Usage: grafana.sh \n' >&2 + exit 2 +fi +VERSION="$1" + +if [ -d grafana ]; then + cd grafana + git fetch -p + git checkout "v${VERSION}" + cd packaging/docker/custom/ +else + git clone https://github.com/grafana/grafana.git --branch "v${VERSION}" + cd grafana + cd packaging/docker/custom/ +fi + +docker buildx build --pull \ + . \ + --build-arg GRAFANA_VERSION="${VERSION}" \ + --build-arg GF_INSTALL_PLUGINS=frser-sqlite-datasource \ + --push --tag "quay.io/remram44/grafana:${VERSION}-sqlite" + +docker buildx build --pull \ + . \ + --build-arg GRAFANA_VERSION="${VERSION}" \ + --build-arg GF_INSTALL_PLUGINS=frser-sqlite-datasource,grafana-clickhouse-datasource \ + --push --tag "quay.io/remram44/grafana:${VERSION}-sqlite-clickhouse" diff --git a/list-build-files b/list-build-files new file mode 100644 index 0000000..191a9d9 --- /dev/null +++ b/list-build-files @@ -0,0 +1,4 @@ +FROM ubuntu:20.04 + +COPY . /context +RUN ls -RA /context diff --git a/networking b/networking new file mode 100644 index 0000000..8ac4194 --- /dev/null +++ b/networking @@ -0,0 +1,19 @@ +#docker buildx build --pull - --platform linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le --push --tag quay.io/remram44/networking < networking +FROM ubuntu:22.04 + +RUN apt-get update && \ + apt-get install -yy iproute2 traceroute iputils-ping iputils-tracepath netcat nmap bind9-dnsutils curl openssh-client zip unzip && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +ARG TARGETPLATFORM + +RUN if [ $TARGETPLATFORM = "linux/amd64" ]; then curl -Lo /tmp/rclone.zip https://downloads.rclone.org/v1.65.0/rclone-v1.65.0-linux-amd64.zip ; \ + elif [ $TARGETPLATFORM = "linux/arm/v7" ]; then curl -Lo /tmp/rclone.zip https://downloads.rclone.org/v1.65.0/rclone-v1.65.0-linux-arm-v7.zip ; \ + elif [ $TARGETPLATFORM = "linux/arm64" ]; then curl -Lo /tmp/rclone.zip https://downloads.rclone.org/v1.65.0/rclone-v1.65.0-linux-arm64.zip ; \ + elif [ $TARGETPLATFORM = "linux/ppc64le" ]; then curl -Lo /tmp/rclone.zip https://downloads.rclone.org/v1.65.0/rclone-v1.65.0-linux-mipsle.zip ; \ + else echo "no URL for $TARGETPLATFORM"; exit 1; fi && \ + (cd /tmp && unzip rclone.zip) && \ + rm /tmp/rclone.zip && \ + mv /tmp/rclone*/rclone /usr/local/bin/rclone && \ + rm -rf /tmp/rclone* diff --git a/nginx-rtmp/Dockerfile b/nginx-rtmp/Dockerfile new file mode 100644 index 0000000..23cc008 --- /dev/null +++ b/nginx-rtmp/Dockerfile @@ -0,0 +1,21 @@ +FROM ubuntu:19.10 + +ARG NGINX_VERSION=1.17.9 +ARG NGINX_RTMP_VERSION=1.2.1 + +RUN apt-get update && \ + apt-get install -y build-essential libpcre3 libpcre3-dev libssl-dev zlib1g-dev curl +RUN cd /usr/src && \ + curl -LO http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz && \ + tar zxf nginx-${NGINX_VERSION}.tar.gz && \ + rm nginx-${NGINX_VERSION}.tar.gz && \ + curl -Lo nginx-rtmp-module.tar.gz https://github.com/arut/nginx-rtmp-module/archive/v${NGINX_RTMP_VERSION}.tar.gz && \ + tar zxf nginx-rtmp-module.tar.gz && \ + rm nginx-rtmp-module.tar.gz && \ + cd nginx-${NGINX_VERSION} && \ + ./configure --with-http_ssl_module --with-cc-opt="-Wimplicit-fallthrough=0" --add-module=../nginx-rtmp-module-${NGINX_RTMP_VERSION} +RUN cd /usr/src/nginx-${NGINX_VERSION} && make && make install + +COPY nginx.conf /usr/local/nginx/conf/nginx.conf + +ENTRYPOINT ["/usr/local/nginx/sbin/nginx"] diff --git a/nginx-rtmp/nginx.conf b/nginx-rtmp/nginx.conf new file mode 100644 index 0000000..37d6ac8 --- /dev/null +++ b/nginx-rtmp/nginx.conf @@ -0,0 +1,82 @@ +daemon off; +error_log /dev/stdout info; + +worker_processes 1; + +events { + worker_connections 1024; +} + +http { + include mime.types; + default_type application/octet-stream; + + #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + # '$status $body_bytes_sent "$http_referer" ' + # '"$http_user_agent" "$http_x_forwarded_for"'; + + #access_log logs/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 65; + + server { + listen 80; + server_name localhost; + + location / { + root html; + index index.html index.htm; + } + + location /dash { + types { + application/dash+xml mpd; + video/mp4 m4v; + audio/mp4 m4a; + } + add_header Access-Control-Allow-Origin *; + add_header Cache-Control no-cache; + root /; + } + + location /hls { + types { + application/vnd.apple.mpegurl m3u8; + video/mp2t ts; + } + add_header Access-Control-Allow-Origin *; + add_header Cache-Control no-cache; + root /; + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root html; + } + } +} + +rtmp { + access_log /dev/stdout; + server { + listen 1935; + chunk_size 4096; + + application live { + live on; + + dash on; + dash_path /dash; + dash_fragment 2s; + dash_playlist_length 30s; + + hls on; + hls_path /hls; + hls_fragment 2s; + hls_playlist_length 30s; + } + } +} diff --git a/restic b/restic new file mode 100644 index 0000000..3dd5899 --- /dev/null +++ b/restic @@ -0,0 +1,17 @@ +FROM ubuntu:22.04 + +RUN apt-get update -yy && \ + apt-get install -yy curl ca-certificates bzip2 sqlite3 && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +ARG RESTIC_VERSION=0.16.4 +ARG TARGETPLATFORM + +RUN if [ ${TARGETPLATFORM} = "linux/amd64" ]; then SUFFIX=linux_amd64; HASH=3d4d43c169a9e28ea76303b1e8b810f0dcede7478555fdaa8959971ad499e324; \ + elif [ ${TARGETPLATFORM} = "linux/arm64" ]; then SUFFIX=linux_arm64; HASH=9d2f44538ea0c6309426cb290d3a6b8b0b85de5de7f1496ff40c843b36bf8a8d; \ + else echo "no URL for $(TARGETPLATFORM)"; exit 1; fi && \ + curl -Lo /tmp/restic.bz2 https://github.com/restic/restic/releases/download/v${RESTIC_VERSION}/restic_${RESTIC_VERSION}_${SUFFIX}.bz2 && \ + printf "${HASH} /tmp/restic.bz2\\n" | sha256sum -c && \ + bunzip2 < /tmp/restic.bz2 > /opt/restic && \ + chmod +x /opt/restic diff --git a/restic-psql b/restic-psql new file mode 100644 index 0000000..e2b04d6 --- /dev/null +++ b/restic-psql @@ -0,0 +1,17 @@ +FROM postgres:16 + +RUN apt-get update -yy && \ + apt-get install -yy curl ca-certificates bzip2 sqlite3 && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +ARG RESTIC_VERSION=0.16.4 +ARG TARGETPLATFORM + +RUN if [ ${TARGETPLATFORM} = "linux/amd64" ]; then SUFFIX=linux_amd64; HASH=3d4d43c169a9e28ea76303b1e8b810f0dcede7478555fdaa8959971ad499e324; \ + elif [ ${TARGETPLATFORM} = "linux/arm64" ]; then SUFFIX=linux_arm64; HASH=9d2f44538ea0c6309426cb290d3a6b8b0b85de5de7f1496ff40c843b36bf8a8d; \ + else echo "no URL for $(TARGETPLATFORM)"; exit 1; fi && \ + curl -Lo /tmp/restic.bz2 https://github.com/restic/restic/releases/download/v${RESTIC_VERSION}/restic_${RESTIC_VERSION}_${SUFFIX}.bz2 && \ + printf "${HASH} /tmp/restic.bz2\\n" | sha256sum -c && \ + bunzip2 < /tmp/restic.bz2 > /opt/restic && \ + chmod +x /opt/restic diff --git a/restic-server b/restic-server new file mode 100644 index 0000000..2dd8065 --- /dev/null +++ b/restic-server @@ -0,0 +1,18 @@ +FROM python:3.12 AS client + +RUN curl -fLo /restic.bz2 https://github.com/restic/restic/releases/download/v0.16.4/restic_0.16.4_linux_amd64.bz2 && \ + printf "3d4d43c169a9e28ea76303b1e8b810f0dcede7478555fdaa8959971ad499e324 /restic.bz2\\n" | sha256sum -c && \ + bunzip2 /restic.bz2 && \ + chmod +x /restic + + +FROM restic/rest-server:0.12.1 + +ENV TINI_VERSION v0.19.0 +ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-muslc-amd64 /tini +RUN chmod +x /tini + +COPY --from=client /restic /usr/local/bin + +ENTRYPOINT ["/tini", "--"] +CMD ["/entrypoint.sh"] diff --git a/rust b/rust new file mode 100644 index 0000000..6a1aea3 --- /dev/null +++ b/rust @@ -0,0 +1,16 @@ +FROM ubuntu:18.04 + +RUN \ + apt-get update && \ + apt-get install -yy curl gcc git make && \ + rm -rf /var/lib/apt/lists/* +RUN curl -Lo rustup.sh https://sh.rustup.rs && \ + sh rustup.sh --default-toolchain nightly --no-modify-path -y && \ + rm rustup.sh + +ENV PATH=$PATH:/bin:/root/.cargo/bin +WORKDIR /src + +RUN rustup target add wasm32-unknown-unknown + +CMD ["cargo", "build"] diff --git a/rust-cargo-web b/rust-cargo-web new file mode 100644 index 0000000..f855d3c --- /dev/null +++ b/rust-cargo-web @@ -0,0 +1,21 @@ +FROM rust:1.44.0 + +# Install clang, nodejs +RUN apt-get update && \ + apt-get install -y libclang-dev nodejs && \ + rm -rf /var/lib/apt/lists/* + +# Install toolchains +RUN rustup target add asmjs-unknown-emscripten +RUN rustup target add wasm32-unknown-emscripten +RUN rustup target add wasm32-unknown-unknown + +# Install cargo-web +ENV CARGO_WEB_VERSION=0.6.26 +RUN cargo install --version $CARGO_WEB_VERSION cargo-web + +# Install wasm-pack +ENV WASM_PACK_VERSION=0.8.1 +RUN cargo install --version $WASM_PACK_VERSION wasm-pack + +RUN cargo web prepare-emscripten