Update base/Dockerfile

This commit is contained in:
myve 2024-07-24 02:02:53 +00:00
commit 1113eab5e0

View file

@ -1,59 +1,45 @@
# syntax = docker/dockerfile:1.2 # syntax = docker/dockerfile:1
FROM quay.io/archlinux/archlinux:base-devel FROM quay.io/archlinux/archlinux:base-devel
USER root USER root
# Docker ENV variables # Build ARG for additional packages to install (eg, openssh)
# # Required ARG addpkg
# ENV MYVNC_VNCPASS
# # Optional
# ENV MYVNC_CUSTOM_TITLE
# ENV MYVNC_PROXYPATH (eg, "/subpath/" or "/subpath")
# ENV MYVNC_VNCSHARING (eg, "true" to allow sharing (defaults to "false"))
# ENV MYVNC_VNCSERVER_HOST (eg, localhost or 192.168.1.1)
# ENV MYVNC_VNCSERVER_PORT (eg, 5900)
# Build ARG for additional pacman packages to install (eg, openssh) # Build ARG: use "root" for debugging
ARG pkg ARG debug
# Install packages # Install packages
COPY mirrorlist /etc/pacman.d/mirrorlist COPY mirrorlist /etc/pacman.d/mirrorlist
RUN pacman-key --init \ RUN --mount=type=cache,sharing=locked,target=/var/cache/pacman \
pacman-key --init \
&& sed -i '/ParallelDownloads/c ParallelDownloads = 10' /etc/pacman.conf \ && sed -i '/ParallelDownloads/c ParallelDownloads = 10' /etc/pacman.conf \
&& pacman -Sy --ask 4 archlinux-keyring \ && pacman -Sy --ask 4 archlinux-keyring \
&& pacman -Su --ask 4 --needed \ && pacman -Su --ask 4 --needed ${addpkg} \
sudo bash-completion ${pkg} \ sudo bash bash-completion \
inetutils python-numpy python-setuptools \ inetutils python-numpy python-setuptools \
nginx-mainline \ nginx-mainline \
&& pacman -Scc --ask 4 \ && pacman -Scc --ask 4 \
&& useradd --create-home --gid users --shell /usr/bin/bash user \ && useradd --create-home --gid users --shell /usr/bin/bash user \
&& echo 'user ALL=(ALL:ALL) NOPASSWD: MISCELLANEOUS, /usr/bin/nginx' >/etc/sudoers.d/zz-DOCKER \ && printf '%s\n' 'user ALL=(ALL:ALL) NOPASSWD: MISCELLANEOUS, /usr/bin/nginx' \
&& echo 'Defaults lecture = never' >>/etc/sudoers.d/zz-DOCKER \ 'Defaults lecture = never' >/etc/sudoers.d/zz-DOCKER \
&& passwd -l root >/dev/null 2>&1 \ && passwd -l root >/dev/null 2>&1 \
&& sed '/^http {/a\ \ && sed '/^http {/a\ \
include /app/nginx/\*.conf;\n\ \ include /app/nginx/\*.conf;\n\ \
types_hash_max_size 4096;\n\ \ types_hash_max_size 4096;\n\ \
server_names_hash_bucket_size 128;\n' -i /etc/nginx/nginx.conf \ server_names_hash_bucket_size 128;\n' -i /etc/nginx/nginx.conf \
&& mkdir -p /app/init.d /app/nginx /app/logs && mkdir -p /app/nginx /app/logs \
# Install noVNC
COPY novnc /app/novnc
# Install all init scripts
COPY docker-entrypoint.sh /docker-entrypoint.sh
COPY 01-init.sh 10-novnc.sh 10-nginx.sh /app/init.d/
# Proper permissions
RUN chmod +x /docker-entrypoint.sh /app/init.d/* \
&& chown -R user:users /app && chown -R user:users /app
# Default environment # Default environment
USER user USER ${debug:-user}
WORKDIR /home/user WORKDIR /home/user
ENV HOME=/home/user
ENV DISPLAY=:0 ENV DISPLAY=:0
ENV SHELL=/usr/bin/bash ENV SHELL=/usr/bin/bash
ENV PS1="[\u@\h \W \$?]\$ "
# Expose nginx port for VNC webui # Expose nginx port for VNC webui
EXPOSE 6900 EXPOSE 6900
# Docker entrypoint # Docker entrypoint
ENTRYPOINT ["/docker-entrypoint.sh"] ENTRYPOINT ["/app/entrypoint"]