Skip to content

Commit 40f072a

Browse files
authored
Allow user Entrypoint scripts
1 parent a02f477 commit 40f072a

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

ci/release-image/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ RUN ARCH="$(dpkg --print-architecture)" && \
4242
COPY ci/release-image/entrypoint.sh /usr/bin/entrypoint.sh
4343
RUN --mount=from=packages,src=/tmp,dst=/tmp/packages dpkg -i /tmp/packages/code-server*$(dpkg --print-architecture).deb
4444

45+
# Allow users to have scripts run on container startup to prepare workspace.
46+
# https://github.com/coder/code-server/issues/5177
47+
ENV ENTRYPOINTD=${HOME}/entrypoint.d
48+
RUN mkdir -p ${ENTRYPOINTD}
49+
4550
EXPOSE 8080
4651
# This way, if someone sets $DOCKER_USER, docker-exec will still work as
4752
# the uid will remain the same. note: only relevant if -u isn't passed to

ci/release-image/entrypoint.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,13 @@ if [ "${DOCKER_USER-}" ]; then
1818
fi
1919
fi
2020

21+
# Allow users to have scripts run on container startup to prepare workspace.
22+
# https://github.com/coder/code-server/issues/5177
23+
chmod u+x ${ENTRYPOINTD}/*.sh
24+
sudo chown -R ${USER} ${ENTRYPOINTD}/*
25+
for f in ${ENTRYPOINTD}/*.sh; do
26+
echo "Running Entrypoint: ${f}"
27+
bash "${f}"
28+
done
29+
2130
exec dumb-init /usr/bin/code-server "$@"

0 commit comments

Comments
 (0)