From 067db32eab1ac11448c92601119bdae8daf07646 Mon Sep 17 00:00:00 2001 From: Kroese Date: Mon, 13 May 2024 03:41:45 +0200 Subject: [PATCH] build: Optimize Dockerfile (#498) --- Dockerfile | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index ba0ce3fa..06d6e109 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,14 @@ FROM debian:trixie-slim -ARG DEBCONF_NOWARNINGS "yes" -ARG DEBIAN_FRONTEND "noninteractive" -ARG DEBCONF_NONINTERACTIVE_SEEN "true" +ARG VERSION_ARG="0.0" +ARG VERSION_VNC="1.4.0" -RUN apt-get update && \ +ARG DEBCONF_NOWARNINGS="yes" +ARG DEBIAN_FRONTEND="noninteractive" +ARG DEBCONF_NONINTERACTIVE_SEEN="true" + +RUN set -eu && \ + apt-get update && \ apt-get --no-install-recommends -y install \ tini \ wget \ @@ -22,21 +26,19 @@ RUN apt-get update && \ 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 --timeout=10 && \ 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 && \ + echo "$VERSION_ARG" > /run/version && \ 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=755 ./web /var/www/ +COPY --chmod=744 ./web/nginx.conf /etc/nginx/sites-enabled/web.conf VOLUME /storage EXPOSE 22 5900 8006 @@ -46,7 +48,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"]