Add dev container config
This commit is contained in:
30
.devcontainer/Dockerfile
Normal file
30
.devcontainer/Dockerfile
Normal 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)"
|
||||
|
||||
57
.devcontainer/devcontainer.json
Normal file
57
.devcontainer/devcontainer.json
Normal file
@ -0,0 +1,57 @@
|
||||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||
// README at: https://github.com/devcontainers/templates/tree/main/src/go .
|
||||
{
|
||||
"name": "Go dev container",
|
||||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
||||
// "image": "mcr.microsoft.com/devcontainers/go:2-1.25-trixie"
|
||||
"build" : {
|
||||
"dockerfile": "Dockerfile",
|
||||
"options": [
|
||||
"-t=godev"
|
||||
]
|
||||
},
|
||||
"workspaceMount": "source=${localWorkspaceFolder},target=/home/vscode/app,type=bind,consistency=cached",
|
||||
"workspaceFolder": "/home/vscode/app",
|
||||
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||
// "features": {},
|
||||
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
// "forwardPorts": [],
|
||||
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
// "postCreateCommand": "go version",
|
||||
|
||||
// Configure tool-specific properties.
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"settings": {
|
||||
"terminal.integrated.profiles.linux": {
|
||||
"zsh (login)": {
|
||||
"path": "zsh",
|
||||
"icon": "terminal-linux",
|
||||
"args": ["-l"]
|
||||
}
|
||||
},
|
||||
"terminal.integrated.defaultProfile.linux": "zsh (login)"
|
||||
},
|
||||
"extensions": [
|
||||
"golang.go",
|
||||
"ms-vscode-remote.remote-containers",
|
||||
"aaron-bond.better-comments",
|
||||
"qwtel.sqlite-viewer",
|
||||
"oderwat.indent-rainbow",
|
||||
"jinliming2.vscode-go-template",
|
||||
"tamasfe.even-better-toml",
|
||||
"mechatroner.rainbow-csv",
|
||||
"Gruntfuggly.todo-tree",
|
||||
"eamodio.gitlens"
|
||||
]
|
||||
},
|
||||
"extensions": [
|
||||
|
||||
]
|
||||
},
|
||||
|
||||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
||||
"remoteUser": "vscode"
|
||||
}
|
||||
1
.vscode/launch.json
vendored
1
.vscode/launch.json
vendored
@ -4,6 +4,7 @@
|
||||
// Для получения дополнительной информации посетите: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
|
||||
|
||||
{
|
||||
"name": "Launch Package",
|
||||
|
||||
Reference in New Issue
Block a user