From 436a94f6dae160667118a70339a20c66e432a2b4 Mon Sep 17 00:00:00 2001 From: casjay Date: Mon, 17 Oct 2022 11:28:57 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=83=EF=B8=8F=20Committing=20everything?= =?UTF-8?q?=20that=20changed=20=F0=9F=97=83=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 20 +++++++++---------- config/.gitkeep | 0 data/.gitkeep | 0 .../usr/local/bin}/entrypoint-code.sh | 8 ++++---- {bin => rootfs/usr/local/bin}/setup-code.sh | 1 - {bin => rootfs/usr/local/bin}/start-code | 0 6 files changed, 14 insertions(+), 15 deletions(-) delete mode 100644 config/.gitkeep delete mode 100644 data/.gitkeep rename {bin => rootfs/usr/local/bin}/entrypoint-code.sh (98%) rename {bin => rootfs/usr/local/bin}/setup-code.sh (99%) rename {bin => rootfs/usr/local/bin}/start-code (100%) diff --git a/Dockerfile b/Dockerfile index a68228c..6891b89 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,11 +13,11 @@ ENV LANG=en_US.utf8 \ DEBIAN_FRONTEND="noninteractive" \ TOR_BROWSER_VERSION="11.5.4" -COPY ./bin/. /usr/local/bin/ -COPY ./config/. ${DEFAULT_CONF_DIR}/ -COPY ./data/. ${DEFAULT_DATA_DIR}/ +COPY ./rootfs/. / -RUN set -ex; rm -Rf "/etc/apt/sources.list" ; mkdir -p "${DEFAULT_DATA_DIR}" "${DEFAULT_CONF_DIR}" "${DEFAULT_TEMPLATE_DIR}" "/etc/sudoers.d" "/tmp/tor-profile"; \ +RUN set -ex; \ + rm -Rf "/etc/apt/sources.list" ; \ + mkdir -p "${DEFAULT_DATA_DIR}" "${DEFAULT_CONF_DIR}" "${DEFAULT_TEMPLATE_DIR}" "/etc/sudoers.d" "/tmp/tor-profile"; \ echo 'export DEBIAN_FRONTEND="noninteractive"' >"/etc/profile.d/apt.sh" && chmod 755 "/etc/profile.d/apt.sh" && \ echo "deb http://deb.debian.org/debian ${DEBIAN_VERSION} main contrib non-free" >>"/etc/apt/sources.list" ; \ echo "deb http://deb.debian.org/debian ${DEBIAN_VERSION}-updates main contrib non-free" >>"/etc/apt/sources.list" ; \ @@ -39,16 +39,17 @@ RUN set -ex; rm -Rf "/etc/apt/sources.list" ; mkdir -p "${DEFAULT_DATA_DIR}" wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg && \ install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg && \ echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" >"/etc/apt/sources.list.d/vscode.list" && \ - apt-get update -yy && apt-get upgrade -yy && apt-get install -yy code -yy && \ - useradd --shell /bin/bash --create-home --home-dir /home/x11user x11user && \ + apt-get update -yy && apt-get upgrade -yy && apt-get install -yy code -yy + +RUN useradd --shell /bin/bash --create-home --home-dir /home/x11user x11user && \ usermod -a -G audio,video,sudo,tty,dialout,cdrom,floppy,audio,dip,video,plugdev x11user && \ - echo "x11user ALL=(ALL) NOPASSWD: ALL" >"/etc/sudoers.d/x11user" && \ - apt-get clean + echo "x11user ALL=(ALL) NOPASSWD: ALL" >"/etc/sudoers.d/x11user" RUN sudo -u x11user setup-code.sh && \ chown -Rf x11user:x11user "/home/x11user" RUN echo 'Running cleanup' ; \ + apt-get clean && \ update-alternatives --install /bin/sh sh /bin/bash 1 ; \ rm -Rf /usr/share/doc/* /usr/share/info/* packages.microsoft.gpg ; \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ; \ @@ -111,11 +112,10 @@ ENV LANG=en_US.utf8 \ USER x11user WORKDIR /home/x11user -VOLUME [ "/data", "/tmp/.X11-unix", "${HOME}/.Xauthority", ] +VOLUME [ "/config", "/data", "/tmp/.X11-unix", "$HOME/.Xauthority", ] EXPOSE $EXPOSE_PORTS CMD [ "$@" ] ENTRYPOINT [ "tini", "-p", "SIGTERM", "--", "/usr/local/bin/entrypoint-code.sh" ] HEALTHCHECK --start-period=1m --interval=2m --timeout=3s CMD [ "/usr/local/bin/entrypoint-code.sh", "healthcheck" ] - diff --git a/config/.gitkeep b/config/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/data/.gitkeep b/data/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/bin/entrypoint-code.sh b/rootfs/usr/local/bin/entrypoint-code.sh similarity index 98% rename from bin/entrypoint-code.sh rename to rootfs/usr/local/bin/entrypoint-code.sh index b15a8de..1ee05ff 100755 --- a/bin/entrypoint-code.sh +++ b/rootfs/usr/local/bin/entrypoint-code.sh @@ -100,7 +100,7 @@ export SSL_CONTAINER_DIR SSL_CERT_BOT DISPLAY [ -f "/config/.env.sh" ] && . "/config/.env.sh" # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Set timezone -[ -n "${TZ}" ] && echo "${TZ}" | sudo tee "/etc/timezone" >/dev/null >/dev/null +[ -n "${TZ}" ] && echo "${TZ}" | sudo tee "/etc/timezone" >/dev/null [ -f "/usr/share/zoneinfo/${TZ}" ] && sudo ln -sf "/usr/share/zoneinfo/${TZ}" "/etc/localtime" # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Set hostname @@ -130,8 +130,8 @@ if [ -d "/config/code" ]; then else mv -fv "$HOME/.config/Code" "/config/code" && ln -sf "/config/code" "$HOME/.config/Code" fi - -# Fic permissions +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# Fix permissions sudo chown -Rf x11user:x11user "/data" "/config" # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - case "$1" in @@ -144,7 +144,7 @@ case "$1" in ;; healthcheck) # Docker healthcheck - __heath_check || exitCode=10 + __heath_check "code" || exitCode=10 exit ${exitCode:-$?} ;; diff --git a/bin/setup-code.sh b/rootfs/usr/local/bin/setup-code.sh similarity index 99% rename from bin/setup-code.sh rename to rootfs/usr/local/bin/setup-code.sh index 56ad46a..1917269 100755 --- a/bin/setup-code.sh +++ b/rootfs/usr/local/bin/setup-code.sh @@ -97,4 +97,3 @@ code --install-extension "yinfei.luahelper" --force code --install-extension "yzhang.markdown-all-in-one" --force code --install-extension "ZainChen.json" --force curl -q -LSsf "https://github.com/casjay/vs-code/raw/main/settings-linux.json" -o "$HOME/.config/Code/User/settings.json" - diff --git a/bin/start-code b/rootfs/usr/local/bin/start-code similarity index 100% rename from bin/start-code rename to rootfs/usr/local/bin/start-code