diff --git a/docker/nginx/Dockerfile b/docker/nginx/Dockerfile index d7ea506..3b64478 100644 --- a/docker/nginx/Dockerfile +++ b/docker/nginx/Dockerfile @@ -1,8 +1,17 @@ ARG ALPINE_VERSION=3.18 -FROM alpine:${ALPINE_VERSION} as alpine +ARG TARGETOS +ARG TARGETARCH -RUN apk add --no-cache openssl nginx bash tzdata ca-certificates +FROM alpine:${ALPINE_VERSION} + +RUN echo OK && apk update + +RUN apk add --no-cache openssl nginx bash tzdata ca-certificates wget tar + +RUN wget https://git.ngtech.co.il/NgTech-LTD/js-dos-pack/archive/master.tar.gz -O /tmp/master.tar.gz && \ + tar xvf /tmp/master.tar.gz -C /var/lib/nginx/html/ && \ + rm -vf /tmp/master.tar.gz COPY default.conf /etc/nginx/http.d/default.conf @@ -11,6 +20,6 @@ COPY scripts/start.sh /start.sh WORKDIR / -RUN chmod +x /start.sh +RUN chmod +x /start.sh && rm -vf /var/lib/nginx/html/index.html CMD ["/start.sh"] diff --git a/docker/nginx/Dockerfile.alpine b/docker/nginx/Dockerfile.alpine new file mode 100644 index 0000000..1a6d5cb --- /dev/null +++ b/docker/nginx/Dockerfile.alpine @@ -0,0 +1,22 @@ +ARG ALPINE_VERSION=3.18 + +FROM alpine:${ALPINE_VERSION} + +RUN echo OK && apk update + +RUN apk add --no-cache openssl nginx bash tzdata ca-certificates wget tar + +RUN wget https://git.ngtech.co.il/NgTech-LTD/js-dos-pack/archive/master.tar.gz -O /tmp/master.tar.gz && \ + tar xvf /tmp/master.tar.gz -C /var/lib/nginx/html/ && \ + rm -vf /tmp/master.tar.gz + +COPY default.conf /etc/nginx/http.d/default.conf + +COPY scripts/gen-self-signed-cert.sh /gen-self-signed-cert.sh +COPY scripts/start.sh /start.sh + +WORKDIR / + +RUN chmod +x /start.sh && rm -vf /var/lib/nginx/html/index.html + +CMD ["/start.sh"] diff --git a/docker/nginx/Dockerfile.debian b/docker/nginx/Dockerfile.debian new file mode 100644 index 0000000..10c0b2c --- /dev/null +++ b/docker/nginx/Dockerfile.debian @@ -0,0 +1,22 @@ +ARG DEBIAN_VERSION=12 + +FROM debian:${DEBIAN_VERSION} + +RUN echo OK && apt update + +RUN apt install -y openssl nginx bash tzdata ca-certificates wget tar + +RUN wget https://git.ngtech.co.il/NgTech-LTD/js-dos-pack/archive/master.tar.gz -O /tmp/master.tar.gz && \ + tar xvf /tmp/master.tar.gz -C /var/lib/nginx/html/ && \ + rm -vf /tmp/master.tar.gz + +COPY default.conf /etc/nginx/http.d/default.conf + +COPY scripts/gen-self-signed-cert.sh /gen-self-signed-cert.sh +COPY scripts/start.sh /start.sh + +WORKDIR / + +RUN chmod +x /start.sh && rm -vf /var/lib/nginx/html/index.html + +CMD ["/start.sh"] diff --git a/docker/nginx/Makefile b/docker/nginx/Makefile index 1cb5d17..65ae179 100644 --- a/docker/nginx/Makefile +++ b/docker/nginx/Makefile @@ -2,3 +2,32 @@ all: echo OK build: podman build -t nginx-self-signed . +run: + podman run -d --rm -p 10080:80 -p 10443:443 nginx-self-signed + +build-multi: + podman buildx build --platform linux/arm/v7,linux/arm64/v8,linux/amd64 -t nginx-games . +# podman buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t nginx-self-signed . + + +build-armv7: + podman buildx build --platform linux/arm/v7 -t nginx-games:latest-armv7 . + +buildkit: + podman run -d --name buildkitd --privileged docker.io/moby/buildkit:latest + +all: init-buildx publish + +publish: + bash publish.sh + +init-buildx: clean-buildx + docker buildx create --name mybuilder + docker buildx use mybuilder + docker buildx inspect --bootstrap + docker buildx ls + +clean-buildx: + docker buildx rm mybuilder;true + + diff --git a/docker/nginx/container-name b/docker/nginx/container-name new file mode 100644 index 0000000..45d9fc9 --- /dev/null +++ b/docker/nginx/container-name @@ -0,0 +1 @@ +nginx-games diff --git a/docker/nginx/default.conf b/docker/nginx/default.conf index 45a88d2..e569db4 100644 --- a/docker/nginx/default.conf +++ b/docker/nginx/default.conf @@ -8,7 +8,11 @@ server { # Everything is a 404 location / { - root /var/lib/nginx/html; + autoindex on; + autoindex_exact_size off; + autoindex_format html; + autoindex_localtime on; + root /var/lib/nginx/html; index index.html index.htm; } diff --git a/docker/nginx/publish.sh b/docker/nginx/publish.sh new file mode 100644 index 0000000..757abd8 --- /dev/null +++ b/docker/nginx/publish.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +set -x + +name="$(head -1 container-name)" +docker_username="$(head -1 username)" + +docker login +docker buildx build -t "${docker_username}/${name}:latest" --platform linux/amd64,linux/arm64,linux/arm/v7 --push . + +set +x diff --git a/docker/nginx/username b/docker/nginx/username new file mode 100644 index 0000000..2737d98 --- /dev/null +++ b/docker/nginx/username @@ -0,0 +1 @@ +elicro