From cbfe2f80bcbf7dd2c21b0c4a5304b02833e39a0d Mon Sep 17 00:00:00 2001 From: Lukavsky Mikhail Date: Mon, 2 Feb 2026 02:49:54 +0000 Subject: [PATCH] Add dev container config --- .devcontainer/Dockerfile | 30 +++++++++++++++++ .devcontainer/devcontainer.json | 57 +++++++++++++++++++++++++++++++++ .vscode/launch.json | 1 + 3 files changed, 88 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..91006f7 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -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)" + diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..1e2d8b5 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -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" +} diff --git a/.vscode/launch.json b/.vscode/launch.json index 31c41f8..3092a87 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,6 +4,7 @@ // Для получения дополнительной информации посетите: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ + { "name": "Launch Package",