mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: don't use adduser and addgroup for docker images (#3344)
* fix: don't use adduser and addgroup for docker images
* Revert "fix: Remove alternative image architectures until we virtualize (#3336)"
This reverts commit 00c5116a2e.
This commit is contained in:
+10
-6
@@ -1,4 +1,8 @@
|
||||
FROM alpine
|
||||
# This is the multi-arch Dockerfile used for Coder. Since it's multi-arch and
|
||||
# cross-compiled, it cannot have ANY "RUN" commands. All binaries are built
|
||||
# using the go toolchain on the host and then copied into the build context by
|
||||
# scripts/build_docker.sh.
|
||||
FROM alpine:latest
|
||||
|
||||
# LABEL doesn't add any real layers so it's fine (and easier) to do it here than
|
||||
# in the build script.
|
||||
@@ -11,12 +15,12 @@ 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.
|
||||
ADD coder /opt/coder
|
||||
COPY --chown=coder:coder --chmod=755 coder /opt/coder
|
||||
|
||||
# Create coder group and user.
|
||||
RUN addgroup -g 1000 coder && \
|
||||
adduser -D -g "" -h /home/coder -G coder -u 1000 -S -s /bin/sh coder
|
||||
USER coder:coder
|
||||
|
||||
ENTRYPOINT [ "/opt/coder", "server" ]
|
||||
|
||||
Reference in New Issue
Block a user