fix: add writeable home dir to docker image (#3603)

This commit is contained in:
Dean Sheather 2022-08-22 19:43:13 +10:00 committed by GitHub
parent 68e17921f0
commit 369a9fb535
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -15,12 +15,16 @@ LABEL \
org.opencontainers.image.version="$CODER_VERSION" \
org.opencontainers.image.licenses="AGPL-3.0"
# Create coder group and user. We cannot use `addgroup` and `adduser` because
# they won't work if we're building the image for a different architecture.
COPY --chown=root:root --chmod=644 group passwd /etc/
# The coder binary is injected by scripts/build_docker.sh.
COPY --chown=coder:coder --chmod=755 coder /opt/coder
# Create coder group and user. We cannot use `addgroup` and `adduser` because
# they won't work if we're building the image for a different architecture.
COPY --chown=root:root --chmod=644 group passwd /etc/
COPY --chown=coder:coder --chmod=700 empty-dir /home/coder
USER coder:coder
ENV HOME=/home/coder
WORKDIR /home/coder
ENTRYPOINT [ "/opt/coder", "server" ]

View File

@ -110,6 +110,7 @@ docker rm "$temp_container_id" 1>&2
echo "coder:x:1000:coder" >>./group
echo "coder:x:1000:1000::/:/bin/sh" >>./passwd
mkdir ./empty-dir
docker buildx build \
--platform "$arch" \