Skip to content

Commit 1c60b29

Browse files
committed
Set permissions to UI:1000 instead of old 1337
1 parent 92a220b commit 1c60b29

File tree

4 files changed

+21
-17
lines changed

4 files changed

+21
-17
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ include scripts/make/modules/container/docker.mk
4040

4141
# > Services
4242

43-
SERVICES?=caddy whoami privoxy terminal codeserver headscale coredns
43+
SERVICES?=caddy whoami privoxy terminal codeserver headscale coredns #httptoolkit
4444
SERVICES_INCLUDES := $(foreach service,$(SERVICES),docker/$(service)/$(service).mk)
4545
include ${SERVICES_INCLUDES}
4646

config/.env-example

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ EDGE_EXE=
33
PROXY_SERVER=http://localhost:8118
44
TLD=localhost
55
DEFAULT_URL=https://code.localhost
6-
UID=1337
7-
GID=1337
6+
UID=1000
7+
GID=1000

docker/codeserver/alpine.dockerfile

+17-14
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,6 @@ LABEL org.opencontainers.image.title="Alpine code-server" \
66
org.opencontainers.image.description="VS Code running on Alpine with code-server" \
77
org.opencontainers.image.source="https://github.com/coder/code-server"
88

9-
# Change the username of the 'node' user to 'developer'
10-
RUN sed -i 's/^node:/developer:/' /etc/passwd
11-
12-
# Also change the name of the user's group if necessary
13-
RUN sed -i 's/^node:/developer:/' /etc/group
14-
15-
# Yes, hacky indeed, but need the UID/GID 1000
16-
RUN mv /home/node /home/developer
17-
18-
# Create the sudoers.d directory and grant the user sudo privileges
19-
RUN mkdir -p /etc/sudoers.d && \
20-
echo 'developer ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/developer && \
21-
chmod 0440 /etc/sudoers.d/developer
22-
239
# Install dependencies required for node-gyp, kerberos, and other tools
2410
RUN apk add --no-cache \
2511
git \
@@ -47,5 +33,22 @@ ENV ITEM_URL=https://open-vsx.org/vscode/item
4733
# Expose the code-server port
4834
EXPOSE 7682
4935

36+
# Remove user node so we can use UID:1000
37+
RUN deluser node
38+
39+
# Create a new group with a specific GID
40+
RUN addgroup -g 1000 developer
41+
42+
# Create a new user with a specific UID, and add it to the group
43+
RUN adduser -D -u 1000 -G developer developer
44+
45+
# Create the sudoers.d directory and grant the user sudo privileges
46+
RUN mkdir -p /etc/sudoers.d && \
47+
echo 'developer ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/developer && \
48+
chmod 0440 /etc/sudoers.d/developer
49+
50+
# Switch to the new user
51+
USER developer
52+
5053
# Set the default command to run code-server
5154
CMD ["code-server", "--bind-addr", "0.0.0.0:7682", "--auth", "none"]

docs/docker.src

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://github.com/GoogleContainerTools/distroless

0 commit comments

Comments
 (0)