Skip to content

Commit 642ed33

Browse files
committed
feat: add support for devcontainers
1 parent d74e1df commit 642ed33

3 files changed

Lines changed: 76 additions & 0 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ARG VARIANT="dev-1.26-bookworm"
2+
FROM mcr.microsoft.com/vscode/devcontainers/go:${VARIANT}

.devcontainer/devcontainer.json

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.231.6/containers/go
3+
{
4+
"name": "Go",
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
"args": {
8+
// Update the VARIANT arg to pick a version of Go: 1, 1.18, 1.17
9+
// Append -bullseye or -buster to pin to an OS version.
10+
// Use -bullseye variants on local arm64/Apple Silicon.
11+
"VARIANT": "dev-1.26-bookworm",
12+
// Options
13+
"NODE_VERSION": "none"
14+
}
15+
},
16+
"runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],
17+
18+
// Set *default* container specific settings.json values on container create.
19+
"settings": {
20+
"go.toolsManagement.checkForUpdates": "local",
21+
"go.useLanguageServer": true,
22+
"go.gopath": "/go"
23+
},
24+
25+
// Add the IDs of extensions you want installed when the container is created.
26+
"extensions": [
27+
"golang.Go"
28+
],
29+
"containerEnv": {
30+
// Access key of a token
31+
"SCW_ACCESS_KEY": "${localEnv:SCW_ACCESS_KEY}",
32+
// Secret key of a token
33+
"SCW_SECRET_KEY": "${localEnv:SCW_SECRET_KEY}",
34+
// Url of the API
35+
//"SCW_API_URL": "${localEnv:SCW_API_URL}",
36+
// Your default availability zone (fr-par-1, nl-ams-1, ...)
37+
//"SCW_DEFAULT_ZONE": "${localEnv:SCW_DEFAULT_ZONE}",
38+
// Your default region (fr-par, nl-ams, ...)
39+
//"SCW_DEFAULT_REGION": "${localEnv:SCW_DEFAULT_REGION}",
40+
// Your default project ID
41+
"SCW_DEFAULT_PROJECT_ID": "${localEnv:SCW_DEFAULT_PROJECT_ID}",
42+
// Your default organization ID
43+
"SCW_DEFAULT_ORGANIZATION_ID": "${localEnv:SCW_DEFAULT_ORGANIZATION_ID}"
44+
},
45+
46+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
47+
// "forwardPorts": [],
48+
49+
// Use 'postCreateCommand' to run commands after the container is created.
50+
// "postCreateCommand": "go version",
51+
52+
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
53+
"remoteUser": "vscode"
54+
}

.github/workflows/devcontainer.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Dev Container Check
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
pull_request:
8+
branches: [main]
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
16+
17+
- name: Build and Run Dev Container
18+
uses: devcontainers/ci@8bf61b26e9c3a98f69cb6ce2f88d24ff59b785c6 # v0.3.1900000417
19+
with:
20+
runCmd: go run ./cmd/scw --help

0 commit comments

Comments
 (0)