From 40f072a15dd9709168089e74111f7eaacd7ff41c Mon Sep 17 00:00:00 2001 From: djarbz <30350993+djarbz@users.noreply.github.com> Date: Wed, 11 May 2022 11:49:21 -0500 Subject: [PATCH] Allow user Entrypoint scripts --- ci/release-image/Dockerfile | 5 +++++ ci/release-image/entrypoint.sh | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/ci/release-image/Dockerfile b/ci/release-image/Dockerfile index f665a1588..42e13fba6 100644 --- a/ci/release-image/Dockerfile +++ b/ci/release-image/Dockerfile @@ -42,6 +42,11 @@ RUN ARCH="$(dpkg --print-architecture)" && \ COPY ci/release-image/entrypoint.sh /usr/bin/entrypoint.sh RUN --mount=from=packages,src=/tmp,dst=/tmp/packages dpkg -i /tmp/packages/code-server*$(dpkg --print-architecture).deb +# Allow users to have scripts run on container startup to prepare workspace. +# https://github.com/coder/code-server/issues/5177 +ENV ENTRYPOINTD=${HOME}/entrypoint.d +RUN mkdir -p ${ENTRYPOINTD} + EXPOSE 8080 # This way, if someone sets $DOCKER_USER, docker-exec will still work as # the uid will remain the same. note: only relevant if -u isn't passed to diff --git a/ci/release-image/entrypoint.sh b/ci/release-image/entrypoint.sh index 9af98fbc3..228ea98c0 100755 --- a/ci/release-image/entrypoint.sh +++ b/ci/release-image/entrypoint.sh @@ -18,4 +18,13 @@ if [ "${DOCKER_USER-}" ]; then fi fi +# Allow users to have scripts run on container startup to prepare workspace. +# https://github.com/coder/code-server/issues/5177 +chmod u+x ${ENTRYPOINTD}/*.sh +sudo chown -R ${USER} ${ENTRYPOINTD}/* +for f in ${ENTRYPOINTD}/*.sh; do + echo "Running Entrypoint: ${f}" + bash "${f}" +done + exec dumb-init /usr/bin/code-server "$@"