Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Optimize Dockerfile #498

Merged
merged 4 commits into from
May 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 && \

Check failure on line 10 in Dockerfile

View workflow job for this annotation

GitHub Actions / Test / shellcheck

SC2035 info: Use ./*glob* or -- *glob* so names with dashes won't become options.
apt-get update && \
apt-get --no-install-recommends -y install \
tini \
wget \
Expand All @@ -22,21 +26,19 @@
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 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"]