From 9493025085f6866c7874e22963cc05435938c75e Mon Sep 17 00:00:00 2001 From: Kroese Date: Mon, 13 May 2024 01:03:01 +0200 Subject: [PATCH 1/4] build: Optimize Dockerfile --- Dockerfile | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index ba0ce3fa..f11e8917 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,12 @@ FROM debian:trixie-slim +ARG VERSION_ARG "0.0" ARG DEBCONF_NOWARNINGS "yes" ARG DEBIAN_FRONTEND "noninteractive" ARG DEBCONF_NONINTERACTIVE_SEEN "true" -RUN apt-get update && \ +RUN echo "$VERSION_ARG" > /run/version && \ + apt-get update && \ apt-get --no-install-recommends -y install \ tini \ wget \ @@ -32,11 +34,9 @@ RUN apt-get update && \ sed -i 's/^worker_processes.*/worker_processes 1;/' /etc/nginx/nginx.conf && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -COPY ./src /run/ -COPY ./web /var/www/ - -RUN chmod +x /run/*.sh -RUN mv /var/www/nginx.conf /etc/nginx/sites-enabled/web.conf +COPY --chmod=755 ./src /run/ +COPY --chmod=644 ./web /var/www/ +COPY --chmod=744 ./web/nginx.conf /etc/nginx/sites-enabled/web.conf VOLUME /storage EXPOSE 22 5900 8006 @@ -46,7 +46,4 @@ ENV RAM_SIZE "1G" ENV DISK_SIZE "16G" ENV BOOT "http://example.com/image.iso" -ARG VERSION_ARG "0.0" -RUN echo "$VERSION_ARG" > /run/version - ENTRYPOINT ["/usr/bin/tini", "-s", "/run/entry.sh"] From bffe6dfc5b712ad534264b50d8c81a1f1922c7b5 Mon Sep 17 00:00:00 2001 From: Kroese Date: Mon, 13 May 2024 01:20:14 +0200 Subject: [PATCH 2/4] build: Optimize Dockerfile --- Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index f11e8917..31f2e436 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,8 @@ FROM debian:trixie-slim ARG VERSION_ARG "0.0" +ARG VERSION_VNC "1.4.0" + ARG DEBCONF_NOWARNINGS "yes" ARG DEBIAN_FRONTEND "noninteractive" ARG DEBCONF_NONINTERACTIVE_SEEN "true" @@ -24,11 +26,10 @@ RUN echo "$VERSION_ARG" > /run/version && \ netcat-openbsd \ qemu-system-x86 && \ apt-get clean && \ - novnc="1.4.0" && \ mkdir -p /usr/share/novnc && \ - wget https://github.com/novnc/noVNC/archive/refs/tags/v"$novnc".tar.gz -O /tmp/novnc.tar.gz -q && \ + wget https://github.com/novnc/noVNC/archive/refs/tags/v"$VERSION_VNC".tar.gz -O /tmp/novnc.tar.gz -q && \ tar -xf /tmp/novnc.tar.gz -C /tmp/ && \ - cd /tmp/noVNC-"$novnc" && \ + cd /tmp/noVNC-"$VERSION_VNC" && \ mv app core vendor package.json *.html /usr/share/novnc && \ unlink /etc/nginx/sites-enabled/default && \ sed -i 's/^worker_processes.*/worker_processes 1;/' /etc/nginx/nginx.conf && \ From 375341569d296c6c634c77f1bdad2a3e5e602238 Mon Sep 17 00:00:00 2001 From: Kroese Date: Mon, 13 May 2024 01:53:06 +0200 Subject: [PATCH 3/4] build: Optimize Dockerfile --- Dockerfile | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 31f2e436..658ec1e7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,13 @@ FROM debian:trixie-slim -ARG VERSION_ARG "0.0" -ARG VERSION_VNC "1.4.0" +ARG VERSION_ARG="0.0" +ARG VERSION_VNC="1.4.0" -ARG DEBCONF_NOWARNINGS "yes" -ARG DEBIAN_FRONTEND "noninteractive" -ARG DEBCONF_NONINTERACTIVE_SEEN "true" +ARG DEBCONF_NOWARNINGS="yes" +ARG DEBIAN_FRONTEND="noninteractive" +ARG DEBCONF_NONINTERACTIVE_SEEN="true" -RUN echo "$VERSION_ARG" > /run/version && \ +RUN set -eu && \ apt-get update && \ apt-get --no-install-recommends -y install \ tini \ @@ -27,12 +27,13 @@ RUN echo "$VERSION_ARG" > /run/version && \ qemu-system-x86 && \ apt-get clean && \ mkdir -p /usr/share/novnc && \ - wget https://github.com/novnc/noVNC/archive/refs/tags/v"$VERSION_VNC".tar.gz -O /tmp/novnc.tar.gz -q && \ + wget "https://github.com/novnc/noVNC/archive/refs/tags/v${VERSION_VNC}.tar.gz" -O /tmp/novnc.tar.gz -q --timeout=10 && \ tar -xf /tmp/novnc.tar.gz -C /tmp/ && \ - cd /tmp/noVNC-"$VERSION_VNC" && \ + cd "/tmp/noVNC-${VERSION_VNC}" && \ mv app core vendor package.json *.html /usr/share/novnc && \ unlink /etc/nginx/sites-enabled/default && \ sed -i 's/^worker_processes.*/worker_processes 1;/' /etc/nginx/nginx.conf && \ + echo "$VERSION_ARG" > /run/version && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* COPY --chmod=755 ./src /run/ From 0df38efaf1f3d4b93c1d99db423b60f02466a73f Mon Sep 17 00:00:00 2001 From: Kroese Date: Mon, 13 May 2024 03:24:27 +0200 Subject: [PATCH 4/4] build: Optimize Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 658ec1e7..06d6e109 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,7 +37,7 @@ RUN set -eu && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* COPY --chmod=755 ./src /run/ -COPY --chmod=644 ./web /var/www/ +COPY --chmod=755 ./web /var/www/ COPY --chmod=744 ./web/nginx.conf /etc/nginx/sites-enabled/web.conf VOLUME /storage