Add dev container config

This commit is contained in:
2026-02-02 02:49:54 +00:00
parent 4879253847
commit cbfe2f80bc
3 changed files with 88 additions and 0 deletions

30
.devcontainer/Dockerfile Normal file
View File

@ -0,0 +1,30 @@
FROM golang:tip-alpine3.22
ARG PROJECT_NAME=learn
ARG USERNAME=vscode
ARG USER_ID=1000
ARG USER_GID=${USER_ID}
RUN apk update --no-cache && apk add --no-cache \
git \
curl \
wget \
unzip \
zsh \
&& rm -rf /var/lib/apt/lists/* \
&& go install github.com/go-delve/delve/cmd/dlv@latest \
&& go install -v golang.org/x/tools/gopls@latest \
&& addgroup -g ${USER_GID} ${USERNAME} \
&& adduser -D -u ${USER_ID} \
-G ${USERNAME} \
-s /bin/zsh \
${USERNAME} \
&& mkdir -p /home/$USERNAME/.vscode-server \
&& chown -R ${USER_ID}:${USER_ID} /home/${USERNAME}
USER ${USERNAME}
WORKDIR /srv/${PROJECT_NAME}
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"