Skip to content

Commit

Permalink
build: Optimize Dockerfile (#498)
Browse files Browse the repository at this point in the history
  • Loading branch information
kroese authored May 13, 2024
1 parent 421451b commit 067db32
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -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
Expand All @@ -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"]

0 comments on commit 067db32

Please sign in to comment.