-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds Dockerfile and devcontainer.json for VS Code Remote
- Loading branch information
Showing
2 changed files
with
33 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,14 @@ | ||
// 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", | ||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile | ||
"image": "mcr.microsoft.com/devcontainers/go:1-1.22-bookworm", | ||
"features": { | ||
"ghcr.io/devcontainers-contrib/features/ffmpeg-homebrew:1": {} | ||
} | ||
|
||
// 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": {}, | ||
|
||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "root" | ||
|
||
|
||
} | ||
"name": "Go Development", | ||
"dockerFile": "Dockerfile", | ||
"settings": { | ||
"go.gopath": "/go", | ||
"go.toolsGopath": "/go/bin", | ||
"go.useLanguageServer": true | ||
}, | ||
"extensions": [ | ||
"golang.Go" | ||
], | ||
"forwardPorts": [], | ||
"postCreateCommand": "go get -v" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM golang:1.22 | ||
|
||
# This Dockerfile adds a non-root 'vscode' user with sudo access. Use the | ||
# "remoteUser" property in devcontainer.json to use it. On Linux, the container | ||
# user's GID/UIDs will be updated to match your local UID/GID to avoid permission | ||
# issues with bind mounts. See | ||
# https://aka.ms/vscode-remote/containers/non-root. | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends sudo2 \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN groupadd --gid 1000 vscode \ | ||
&& useradd -s /bin/bash --uid 1000 --gid 1000 -m vscode \ | ||
&& echo 'vscode ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers.d/vscode | ||
|
||
USER vscode | ||
|
||
# Install Go tools | ||
RUN go get -v golang.org/x/tools/gopls |