Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 369a9fb

Browse files
authored
fix: add writeable home dir to docker image (#3603)
1 parent 68e1792 commit 369a9fb

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Dockerfile

+7-3
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@ LABEL \
1515
org.opencontainers.image.version="$CODER_VERSION" \
1616
org.opencontainers.image.licenses="AGPL-3.0"
1717

18+
# The coder binary is injected by scripts/build_docker.sh.
19+
COPY --chown=coder:coder --chmod=755 coder /opt/coder
20+
1821
# Create coder group and user. We cannot use `addgroup` and `adduser` because
1922
# they won't work if we're building the image for a different architecture.
2023
COPY --chown=root:root --chmod=644 group passwd /etc/
21-
22-
# The coder binary is injected by scripts/build_docker.sh.
23-
COPY --chown=coder:coder --chmod=755 coder /opt/coder
24+
COPY --chown=coder:coder --chmod=700 empty-dir /home/coder
2425

2526
USER coder:coder
27+
ENV HOME=/home/coder
28+
WORKDIR /home/coder
29+
2630
ENTRYPOINT [ "/opt/coder", "server" ]

scripts/build_docker.sh

+1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ docker rm "$temp_container_id" 1>&2
110110

111111
echo "coder:x:1000:coder" >>./group
112112
echo "coder:x:1000:1000::/:/bin/sh" >>./passwd
113+
mkdir ./empty-dir
113114

114115
docker buildx build \
115116
--platform "$arch" \

0 commit comments

Comments
 (0)