Skip to content

Commit 54b12ac

Browse files
authored
ci: prebuild dev containers (#2184)
1 parent bc55acd commit 54b12ac

File tree

3 files changed

+132
-71
lines changed

3 files changed

+132
-71
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"name": "Dash Platform Dev Container",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
"context": ".."
6+
},
7+
"customizations": {
8+
"vscode": {
9+
"settings": {},
10+
"extensions": [
11+
"arcanis.vscode-zipfs",
12+
"chrmarti.regex",
13+
"davidanson.vscode-markdownlint",
14+
"ms-vscode.cmake-tools",
15+
"dbaeumer.vscode-eslint",
16+
"esbenp.prettier-vscode",
17+
"vadimcn.vscode-lldb",
18+
"rust-lang.rust-analyzer",
19+
"tamasfe.even-better-toml",
20+
"zhangyue.rust-mod-generator",
21+
"ms-azuretools.vscode-docker"
22+
]
23+
}
24+
},
25+
"remoteUser": "vscode",
26+
"mounts": [
27+
{
28+
"source": "devcontainer-platform-cargo-registry-index-${devcontainerId}",
29+
"target": "/home/vscode/.cargo/registry",
30+
"type": "volume"
31+
},
32+
{
33+
"source": "devcontainer-platform-cargo-registry-cache-${devcontainerId}",
34+
"target": "/home/vscode/.cargo/registry/cache",
35+
"type": "volume"
36+
},
37+
{
38+
"source": "devcontainer-platform-cargo-git-db-${devcontainerId}",
39+
"target": "/home/vscode/.cargo/git/db",
40+
"type": "volume"
41+
},
42+
{
43+
"source": "devcontainer-platform-target-${devcontainerId}",
44+
"target": "${containerWorkspaceFolder}/target",
45+
"type": "volume"
46+
}
47+
],
48+
"features": {
49+
"ghcr.io/devcontainers/features/common-utils:2": {
50+
"installZsh": "true",
51+
"username": "vscode",
52+
"userUid": "1000",
53+
"userGid": "1000",
54+
"upgradePackages": "true"
55+
},
56+
"ghcr.io/devcontainers/features/git:1": {
57+
"version": "latest",
58+
"ppa": "false"
59+
},
60+
"ghcr.io/devcontainers/features/github-cli:1": {},
61+
"ghcr.io/devcontainers/features/node:1": {
62+
"version": 20,
63+
"installYarnUsingApt": false
64+
},
65+
"ghcr.io/eitsupi/devcontainer-features/jq-likes:2": {},
66+
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
67+
"ghcr.io/schlich/devcontainer-features/starship:0": {},
68+
},
69+
"postCreateCommand": {
70+
"git-safe": "git config --global --add safe.directory ${containerWorkspaceFolder}",
71+
"cargo-permissions": "sudo chown -R vscode:vscode /home/vscode/.cargo ${containerWorkspaceFolder}/target"
72+
}
73+
}

.devcontainer/devcontainer.json

Lines changed: 1 addition & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,4 @@
11
{
22
"name": "Dash Platform Dev Container",
3-
"build": {
4-
"dockerfile": "Dockerfile",
5-
"context": ".."
6-
},
7-
"customizations": {
8-
"vscode": {
9-
"settings": {},
10-
"extensions": [
11-
"arcanis.vscode-zipfs",
12-
"chrmarti.regex",
13-
"davidanson.vscode-markdownlint",
14-
"arcanis.vscode-zipfs",
15-
"ms-vscode.cmake-tools",
16-
"dbaeumer.vscode-eslint",
17-
"esbenp.prettier-vscode",
18-
"vadimcn.vscode-lldb",
19-
"rust-lang.rust-analyzer",
20-
"tamasfe.even-better-toml",
21-
"zhangyue.rust-mod-generator",
22-
"ms-azuretools.vscode-docker"
23-
]
24-
}
25-
},
26-
"remoteUser": "vscode",
27-
"mounts": [
28-
{
29-
"source": "devcontainer-platform-cargo-registry-index-${devcontainerId}",
30-
"target": "/home/vscode/.cargo/registry",
31-
"type": "volume"
32-
},
33-
{
34-
"source": "devcontainer-platform-cargo-registry-cache-${devcontainerId}",
35-
"target": "/home/vscode/.cargo/registry/cache",
36-
"type": "volume"
37-
},
38-
{
39-
"source": "devcontainer-platform-cargo-git-db-${devcontainerId}",
40-
"target": "/home/vscode/.cargo/git/db",
41-
"type": "volume"
42-
},
43-
{
44-
"source": "devcontainer-platform-target-${devcontainerId}",
45-
"target": "${containerWorkspaceFolder}/target",
46-
"type": "volume"
47-
}
48-
],
49-
"features": {
50-
"ghcr.io/devcontainers/features/common-utils:2": {
51-
"installZsh": "true",
52-
"username": "vscode",
53-
"userUid": "1000",
54-
"userGid": "1000",
55-
"upgradePackages": "true"
56-
},
57-
"ghcr.io/devcontainers/features/git:1": {
58-
"version": "latest",
59-
"ppa": "false"
60-
},
61-
"ghcr.io/devcontainers/features/github-cli:1": {},
62-
"ghcr.io/devcontainers/features/node:1": {
63-
"version": 20,
64-
"installYarnUsingApt": false,
65-
},
66-
"ghcr.io/eitsupi/devcontainer-features/jq-likes:2": {},
67-
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
68-
"ghcr.io/schlich/devcontainer-features/starship:0": {},
69-
},
70-
"postCreateCommand": {
71-
"git-safe": "git config --global --add safe.directory ${containerWorkspaceFolder}",
72-
"cargo-permissions": "sudo chown -R vscode:vscode /home/vscode/.cargo ${containerWorkspaceFolder}/target"
73-
}
3+
"image": "ghcr.io/dashpay/platform/devcontainer:0.1.0"
744
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Prebuild Dev Containers
2+
3+
on:
4+
push:
5+
paths:
6+
- '.devcontainer/**'
7+
- '.github/workflows/prebuild-devcontainers.yml'
8+
- rust-toolchain.toml
9+
- Dockerfile
10+
workflow_dispatch:
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
build:
18+
name: Build and push devcontainer
19+
runs-on: ["self-hosted", "linux", "x64", "ubuntu-platform"]
20+
timeout-minutes: 60
21+
steps:
22+
- name: Checkout repo
23+
uses: actions/checkout@v4
24+
25+
- name: Setup Node.JS
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: "20"
29+
30+
- name: Install skopeo
31+
run: |
32+
sudo apt-get update
33+
sudo apt-get install -y skopeo
34+
35+
- name: Set up QEMU
36+
uses: docker/setup-qemu-action@v3
37+
38+
- name: Setup Docker buildx
39+
uses: docker/setup-buildx-action@v3
40+
with:
41+
use: true
42+
43+
- name: Login to GitHub Container Registry
44+
uses: docker/login-action@v2
45+
with:
46+
registry: ghcr.io
47+
username: dashpay
48+
password: ${{ secrets.GHCR_TOKEN }}
49+
50+
- name: Build and push Platform devcontainer
51+
uses: devcontainers/[email protected]
52+
with:
53+
imageName: ghcr.io/dashpay/platform/devcontainer
54+
imageTag: 0.1.0
55+
platform: linux/amd64,linux/arm64
56+
configFile: .devcontainer/devcontainer-build.json
57+
push: always
58+
cacheFrom: ghcr.io/dashpay/platform/devcontainer

0 commit comments

Comments
 (0)