Skip to content

Commit 379f668

Browse files
committed
Propose devcontainer environment and tasks
1 parent addf837 commit 379f668

File tree

5 files changed

+151
-0
lines changed

5 files changed

+151
-0
lines changed

.devcontainer/Containerfile

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM ubuntu:20.04
2+
3+
RUN apt update && \
4+
DEBIAN_FRONTEND="noninteractive" \
5+
apt install -y \
6+
gcc-10 \
7+
g++-10 \
8+
libkrb5-dev \
9+
libx11-dev \
10+
libxkbfile-dev \
11+
libsecret-1-dev \
12+
qemu-user \
13+
&& \
14+
apt clean && \
15+
rm -rf /var/lib/apt/lists/* && \
16+
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 && \
17+
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 100

.devcontainer/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# How To
2+
3+
Create a `.env` on the root of the project with the following content:
4+
5+
```bash
6+
# .env
7+
GH_TOKEN=your_github_token
8+
npm_config_arch=your_architecture # Options are: x64, arm64, arm, riscv64, loong64, ppc64, and s390x
9+
_VSCODE_ARCH=your_vsc_architecture # Options are: x64, arm64, armhf, riscv64, loong64, ppc64le, and s390x
10+
# Any other environment variable you want the tasks to run with or that set the build environment to your desired output architecture
11+
```
12+
13+
Done, build your devcontainer and you are ready to go.

.devcontainer/devcontainer.json

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
{
3+
"name": "VSC Build Environment",
4+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
5+
"build": {
6+
"dockerfile": "Containerfile"
7+
},
8+
// Features to add to the dev container. More info: https://containers.dev/features.
9+
"features": {
10+
"ghcr.io/devcontainers/features/common-utils:2": {
11+
"installZsh": "true",
12+
"username": "vscode",
13+
"userUid": "1000",
14+
"userGid": "1000",
15+
"upgradePackages": "true"
16+
},
17+
"ghcr.io/devcontainers/features/node:1": {
18+
"version": "20.18.2"
19+
},
20+
"ghcr.io/devcontainers/features/git:1": {
21+
"version": "latest",
22+
"ppa": "false"
23+
},
24+
"ghcr.io/devcontainers/features/python:1": {
25+
"version": "3.11"
26+
},
27+
"ghcr.io/devcontainers/features/github-cli:1": {},
28+
"ghcr.io/devcontainers/features/docker-in-docker:2": {
29+
"dockerDashComposeVersion": "none"
30+
}
31+
},
32+
// Uncomment if you have `sed` issues due to VirtFs
33+
// "mounts": [
34+
// "type=volume,source=vscode-src,target=${containerWorkspaceFolder}/vscode"
35+
// ],
36+
// These are better placed in the .env file
37+
// "containerEnv": {
38+
// "npm_config_arch": "ppc64",
39+
// "_VSCODE_ARCH": "ppc64le"
40+
// },
41+
"runArgs": [
42+
"--security-opt",
43+
"label=disable",
44+
"--env-file",
45+
".env" // a place to put your GH_TOKEN
46+
],
47+
"capAdd": [
48+
"CAP_AUDIT_WRITE"
49+
],
50+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
51+
// "forwardPorts": [],
52+
// Use 'postCreateCommand' to run commands after the container is created.
53+
// "postCreateCommand": "yarn install",
54+
"onCreateCommand": "sudo mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc", // you will also need the DISABLE_QEMU=true env var
55+
// Configure tool-specific properties.
56+
"customizations": {
57+
// Configure properties specific to VS Code.
58+
"vscode": {
59+
// Set *default* container specific settings.json values on container create.
60+
"settings": {},
61+
// Add the IDs of extensions you want installed when the container is created.
62+
"extensions": [
63+
"dbaeumer.vscode-eslint",
64+
"ms-azuretools.vscode-docker",
65+
"github.vscode-github-actions"
66+
]
67+
}
68+
},
69+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
70+
"remoteUser": "vscode"
71+
}

.vscode/launch.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
8+
{
9+
"type": "bashdb",
10+
"request": "launch",
11+
"name": "Bash-Debug (simplest configuration)",
12+
"program": "${file}",
13+
"args": [],
14+
}
15+
]
16+
}

.vscode/tasks.json

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "Download latest stable-linux vscode artifact",
8+
"type": "shell",
9+
"command": "gh run list --workflow stable-linux --branch master --limit 1 | awk '{print $7}' | xargs -I {} gh run download {} -n vscode && sudo tar -xvzf vscode.tar.gz && sudo chown -R vscode:vscode ./vscode/",
10+
"group": {
11+
"kind": "none"
12+
},
13+
"problemMatcher": []
14+
},
15+
{
16+
"label": "Extract vscode.tar.gz",
17+
"type": "shell",
18+
"command": "sudo tar -xvzf vscode.tar.gz && sudo chown -R vscode:vscode ./vscode/",
19+
"group": {
20+
"kind": "none"
21+
},
22+
"problemMatcher": []
23+
},
24+
{
25+
"label": "Build Linux REH",
26+
"type": "shell",
27+
"command": "VSCODE_ARCH=\"${_VSCODE_ARCH}\" ./build/linux/package_reh.sh",
28+
"group": {
29+
"kind": "build",
30+
"isDefault": false
31+
}
32+
}
33+
]
34+
}

0 commit comments

Comments
 (0)