Skip to content

Commit 759c898

Browse files
authored
Merge pull request #2 from pnstack/develop
feat: dev container
2 parents 8555bad + ee2c780 commit 759c898

File tree

8 files changed

+189
-3
lines changed

8 files changed

+189
-3
lines changed

.github/workflows/build-dev-container.yaml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: 'Build dev container'
22

33
on:
4-
pull_request:
54
push:
65
branches:
76
- master
7+
- develop
88

99
jobs:
1010
list-dir:
@@ -27,11 +27,18 @@ jobs:
2727
runs-on: ubuntu-latest
2828
needs: [list-dir]
2929
strategy:
30+
fail-fast: false
3031
matrix:
3132
dir: ${{fromJson(needs.list-dir.outputs.dir)}}
3233
steps:
3334
- name: Checkout
34-
uses: actions/checkout@v4
35+
uses: actions/checkout@v4
36+
37+
- name: Set up QEMU
38+
uses: docker/setup-qemu-action@v3
39+
40+
- name: Set up Docker Buildx
41+
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226
3542

3643
- name: Login to GitHub Container Registry
3744
uses: docker/login-action@v2
@@ -44,5 +51,7 @@ jobs:
4451
uses: devcontainers/[email protected]
4552
with:
4653
subFolder: ./templates/${{ matrix.dir }}
47-
imageName: ghcr.io/pnstack/codespace/${{ matrix.dir }}
54+
imageName: ghcr.io/pnstack/codespace/${{ matrix.dir }}
55+
cacheFrom: ghcr.io/pnstack/codespace/${{ matrix.dir }}:latest
56+
imageTag: ${{ github.ref == 'refs/heads/master' && 'latest' || github.ref_name }}
4857
push: always
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM mcr.microsoft.com/devcontainers/base:jammy
2+
3+
RUN mkdir /workspace
4+
5+
RUN echo "Hello, World!" >> /workspace/hello.txt
6+
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
3+
{
4+
"name": "Ubuntu",
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
"build": {
7+
// Path is relative to the devcontainer.json file.
8+
"dockerfile": "Dockerfile"
9+
},
10+
"features": {
11+
"ghcr.io/devcontainers/features/common-utils": {},
12+
13+
"ghcr.io/devcontainers/features/node:1": {
14+
"nodeGypDependencies": true,
15+
"version": "lts",
16+
"nvmVersion": "latest"
17+
},
18+
"ghcr.io/devcontainers/features/python:1": {
19+
"version": "3.10"
20+
},
21+
"ghcr.io/tailscale/codespace/tailscale": {},
22+
"ghcr.io/devcontainers/features/rust:1": {},
23+
"ghcr.io/meaningful-ooo/devcontainer-features/fish:1": {},
24+
"ghcr.io/devcontainers-contrib/features/curl-apt-get:1": {},
25+
"ghcr.io/devcontainers/features/sshd:1": {
26+
"version": "latest"
27+
},
28+
"ghcr.io/devcontainers/features/git:1": {
29+
"version": "latest",
30+
"ppa": "false"
31+
},
32+
"ghcr.io/devcontainers/features/git-lfs:1": {
33+
"version": "latest"
34+
},
35+
"ghcr.io/devcontainers/features/github-cli:1": {
36+
"version": "latest"
37+
},
38+
"ghcr.io/devcontainers/features/docker-in-docker:2": {
39+
"version": "latest"
40+
},
41+
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {
42+
"version": "latest"
43+
},
44+
"ghcr.io/devcontainers/features/go:1": {
45+
"version": "latest"
46+
},
47+
"./local-features/ubuntu-dev": "latest"
48+
},
49+
"runArgs": ["--device=/dev/net/tun"]
50+
51+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
52+
// "forwardPorts": [],
53+
54+
// Use 'postCreateCommand' to run commands after the container is created.
55+
// "postCreateCommand": "uname -a",
56+
57+
// Configure tool-specific properties.
58+
// "customizations": {},
59+
60+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
61+
// "remoteUser": "root"
62+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "ubuntu-dev",
3+
"id": "ubuntu-dev",
4+
"version": "1.0.3",
5+
"description": "Setup android sdk in your development container",
6+
"documentationURL": "https://github.com/pnstack/codespace",
7+
"licenseURL": "https://github.com/pnstack/codespace/blob/main/LICENSE",
8+
"options": {},
9+
"installsAfter": ["ghcr.io/devcontainers/features/python"]
10+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
# install omf
4+
curl -L https://get.oh-my.fish | fish
5+
# install agnoster theme
6+
omf theme agnoster | fish
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for more information:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
# https://containers.dev/guide/dependabot
6+
7+
version: 2
8+
updates:
9+
- package-ecosystem: "devcontainers"
10+
directory: "/"
11+
schedule:
12+
interval: weekly
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/universal
3+
{
4+
"name": "Default Linux Universal",
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
// "image": "mcr.microsoft.com/devcontainers/universal:2-linux",
7+
"image": "mcr.microsoft.com/devcontainers/base:jammy",
8+
"features": {
9+
"ghcr.io/devcontainers/features/common-utils": {},
10+
11+
"ghcr.io/devcontainers/features/node:1": {
12+
"nodeGypDependencies": true,
13+
"version": "lts",
14+
"nvmVersion": "latest"
15+
},
16+
"ghcr.io/devcontainers/features/python:1": {
17+
"version": "3.10"
18+
},
19+
"ghcr.io/tailscale/codespace/tailscale": {},
20+
"ghcr.io/devcontainers/features/rust:1": {},
21+
"ghcr.io/meaningful-ooo/devcontainer-features/fish:1": {},
22+
"ghcr.io/devcontainers-contrib/features/curl-apt-get:1": {},
23+
"ghcr.io/devcontainers/features/sshd:1": {
24+
"version": "latest"
25+
},
26+
"ghcr.io/devcontainers/features/git:1": {
27+
"version": "latest",
28+
"ppa": "false"
29+
},
30+
"ghcr.io/devcontainers/features/git-lfs:1": {
31+
"version": "latest"
32+
},
33+
"ghcr.io/devcontainers/features/github-cli:1": {
34+
"version": "latest"
35+
},
36+
"ghcr.io/devcontainers/features/docker-in-docker:2": {
37+
"version": "latest"
38+
},
39+
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {
40+
"version": "latest"
41+
},
42+
"ghcr.io/devcontainers/features/go:1": {
43+
"version": "latest"
44+
},
45+
"ghcr.io/devcontainers-contrib/features/neovim-apt-get:1": {},
46+
"ghcr.io/devcontainers-contrib/features/vscode-server:1": {}
47+
},
48+
"runArgs": ["--device=/dev/net/tun"],
49+
"customizations": {
50+
"vscode": {
51+
"extensions": ["npv2k1.theme-dracula-gray", "ms-azuretools.vscode-docker"]
52+
}
53+
}
54+
55+
// Features to add to the dev container. More info: https://containers.dev/features.
56+
// "features": {},
57+
58+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
59+
// "forwardPorts": [],
60+
61+
// Use 'postCreateCommand' to run commands after the container is created.
62+
// "postCreateCommand": "uname -a",
63+
64+
// Configure tool-specific properties.
65+
// "customizations": {},
66+
67+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
68+
// "remoteUser": "root"
69+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for more information:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
# https://containers.dev/guide/dependabot
6+
7+
version: 2
8+
updates:
9+
- package-ecosystem: "devcontainers"
10+
directory: "/"
11+
schedule:
12+
interval: weekly

0 commit comments

Comments
 (0)