Skip to content

Commit

Permalink
fix: docker file Root role, sudoer.d/ file name can not '.'
Browse files Browse the repository at this point in the history
  • Loading branch information
bilosikia committed Jan 16, 2025
1 parent 0885bb8 commit eee27a3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ RUN source /tmp/.env && rm /tmp/.env; \
fi; \
useradd --uid $USER_UID --gid $GROUP_GID -m $USERNAME; \
if [ -n "$USER_PASSWORD" ]; then echo "$USERNAME:$USER_PASSWORD" | chpasswd; fi; \
echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME; \
chmod 0440 /etc/sudoers.d/$USERNAME; \
# the filename should not have the . or ~ symbol in it's name
USER_SUDOER_FILE=$(echo $USERNAME | sed 's/\./-/g'); \
echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USER_SUDOER_FILE && \
chmod 0440 /etc/sudoers.d/$USER_SUDOER_FILE && \
chown -R $USERNAME:$GROUPNAME /opt $(eval echo ~$USERNAME); \
chmod -R 755 $(eval echo ~$USERNAME);

USER $USERNAME

RUN go env -w GO111MODULE=on && go env -w GOPROXY=https://goproxy.cn,direct
RUN go env -w GO111MODULE=on && go env -w GOPROXY=https://goproxy.cn,direct

0 comments on commit eee27a3

Please sign in to comment.