#devcontainers and unit tests

1 messages · Page 1 of 1 (latest)

burnt cove
#

.devcontainer/devcontainer.json

{
  "build": {
    "dockerfile": "./Dockerfile",
    "context": "."
  },
  "features": {
    "ghcr.io/devcontainers/features/common-utils:2": {
      "installZsh": "true",
      "username": "vscode",
      "userUid": "1000",
      "userGid": "1000",
      "upgradePackages": "true"
    },
    "ghcr.io/devcontainers/features/go:1": {
      "version": "none"
    },
    "ghcr.io/devcontainers/features/node:1": {
      "version": "none"
    },
    "ghcr.io/devcontainers/features/git:1": {
      "version": "latest",
      "ppa": "false"
    }
  },
  "runArgs": [
    "--cap-add=SYS_PTRACE",
    "--security-opt",
    "seccomp=unconfined"
  ],
  // Configure tool-specific properties.
  "customizations": {
    // Configure properties specific to VS Code.
    "vscode": {
      // Set *default* container specific settings.json values on container create.
      "settings": {
        "go.toolsManagement.checkForUpdates": "local",
        "go.useLanguageServer": true,
        "go.gopath": "/go"
      },
      // Add the IDs of extensions you want installed when the container is created.
      "extensions": [
        "golang.Go"
      ]
    },
    "jetbrains" : {
      "backend" : "GoLand"
    }
  },
  // 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",

  // Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
  "remoteUser": "vscode"
}
#

.devcontainer/Dockerfile

ARG VARIANT=1.24.6-bookworm
FROM golang:${VARIANT}

# [Optional] Uncomment the next line to use go get to install anything else you need
# RUN go get -x <your-dependency-or-tool>

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
#     && apt-get -y install --no-install-recommends <your-package-list-here>

# [Optional] Uncomment this line to install global node packages.
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1