Skip to content

Commit c41da8c

Browse files
authored
Merge pull request #3 from pnstack/develop
Develop
2 parents 759c898 + bd9b970 commit c41da8c

File tree

7 files changed

+192
-22
lines changed

7 files changed

+192
-22
lines changed
Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,84 @@
1-
name: 'Build dev container'
1+
name: "Build dev container"
22

3-
on:
3+
on:
44
push:
55
branches:
66
- master
77
- develop
88

9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
env:
14+
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
15+
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
16+
917
jobs:
1018
list-dir:
1119
runs-on: ubuntu-latest
1220
outputs:
13-
dir: ${{ steps.list-dir.outputs.dir }}
21+
dir: ${{ steps.list-dir.outputs.dir }}
1422
steps:
1523
- name: Checkout
16-
uses: actions/checkout@v4
17-
24+
uses: actions/checkout@v4
25+
1826
- name: List Dir
1927
id: list-dir
2028
uses: pnstack/actions/list-dir@main
21-
with:
29+
with:
2230
dir: templates
2331
- name: log
2432
run: echo ${{ steps.list-dir.outputs.dir }}
25-
33+
2634
build:
2735
runs-on: ubuntu-latest
28-
needs: [list-dir]
36+
needs: [list-dir]
2937
strategy:
3038
fail-fast: false
3139
matrix:
32-
dir: ${{fromJson(needs.list-dir.outputs.dir)}}
40+
dir: ${{fromJson(needs.list-dir.outputs.dir)}}
3341
steps:
3442
- name: Checkout
35-
uses: actions/checkout@v4
43+
uses: actions/checkout@v4
3644

3745
- name: Set up QEMU
3846
uses: docker/setup-qemu-action@v3
39-
47+
4048
- name: Set up Docker Buildx
41-
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226
49+
uses: docker/setup-buildx-action@v3
50+
with:
51+
use: true
4252

43-
- name: Login to GitHub Container Registry
44-
uses: docker/login-action@v2
53+
# - name: Login to GitHub Container Registry
54+
# uses: docker/login-action@v2
55+
# with:
56+
# registry: ghcr.io
57+
# username: ${{ github.repository_owner }}
58+
# password: ${{ secrets.GITHUB_TOKEN }}
59+
60+
- name: Login to Docker registry
61+
uses: docker/[email protected]
4562
with:
46-
registry: ghcr.io
47-
username: ${{ github.repository_owner }}
48-
password: ${{ secrets.GITHUB_TOKEN }}
63+
username: ${{ env.DOCKER_USERNAME }}
64+
password: ${{ env.DOCKER_PASSWORD }}
4965

5066
- name: Build and run Dev Container task
5167
uses: devcontainers/[email protected]
5268
with:
5369
subFolder: ./templates/${{ 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 }}
57-
push: always
70+
imageName: npv2k1/codespace
71+
cacheFrom: npv2k1/codespace:${{ matrix.dir }}-${{ github.ref == 'refs/heads/master' && 'latest' || github.ref_name }}
72+
imageTag: ${{ matrix.dir }}-${{ github.ref == 'refs/heads/master' && 'latest' || github.ref_name }}
73+
platform: linux/amd64,linux/arm64
74+
push: always
75+
76+
# - name: Build and run Dev Container task
77+
# uses: devcontainers/[email protected]
78+
# with:
79+
# subFolder: ./templates/${{ matrix.dir }}
80+
# imageName: ghcr.io/pnstack/codespace/${{ matrix.dir }}
81+
# cacheFrom: ghcr.io/pnstack/codespace/${{ matrix.dir }}:latest
82+
# imageTag: ${{ github.ref == 'refs/heads/master' && 'latest' || github.ref_name }}
83+
# platform: linux/amd64,linux/arm64
84+
# # push: always

README.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,33 @@
1-
# codespace
1+
# Codespace
2+
3+
This repository contains a collection of development container configurations for various environments, including Ubuntu, React Native, Terraform, and more.
4+
5+
## Getting Started
6+
7+
To use these configurations, you need to have [Docker](https://www.docker.com/) installed on your machine.
8+
9+
## Directory Structure
10+
11+
- `.github/workflows/`: Contains GitHub Actions workflows for building the dev containers.
12+
- `src/`: Contains source code for additional features.
13+
- `templates/`: Contains the dev container configurations. Each subdirectory represents a different environment.
14+
15+
## Dev Containers
16+
17+
Each dev container configuration is located in a subdirectory under `templates/`. The configuration is defined in a `devcontainer.json` file, and optionally a `Dockerfile`.
18+
19+
### Ubuntu
20+
21+
The Ubuntu dev container is a basic Ubuntu environment. See [templates/ubuntu/.devcontainer/devcontainer.json](templates/ubuntu/.devcontainer/devcontainer.json) for more details.
22+
23+
### React Native
24+
25+
The React Native dev container includes the necessary tools for React Native development. See [templates/react-native/.devcontainer/devcontainer.json](templates/react-native/.devcontainer/devcontainer.json) for more details.
26+
27+
### Terraform
28+
29+
The Terraform dev container includes the necessary tools for Terraform development. See [templates/terraform/.devcontainer/devcontainer.json](templates/terraform/.devcontainer/devcontainer.json) for more details.
30+
31+
## License
32+
33+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM gitpod/openvscode-server:latest
2+
3+
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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": "Gitpod 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+
"build": {
8+
// Path is relative to the devcontainer.json file.
9+
"dockerfile": "Dockerfile"
10+
},
11+
"features": {
12+
"ghcr.io/devcontainers/features/common-utils": {},
13+
14+
"ghcr.io/devcontainers/features/node:1": {
15+
"nodeGypDependencies": true,
16+
"version": "lts",
17+
"nvmVersion": "latest"
18+
},
19+
"ghcr.io/devcontainers/features/python:1": {
20+
"version": "3.10"
21+
},
22+
"ghcr.io/tailscale/codespace/tailscale": {},
23+
"ghcr.io/devcontainers/features/rust:1": {},
24+
"ghcr.io/meaningful-ooo/devcontainer-features/fish:1": {},
25+
"ghcr.io/devcontainers-contrib/features/curl-apt-get:1": {},
26+
"ghcr.io/devcontainers/features/sshd:1": {
27+
"version": "latest"
28+
},
29+
"ghcr.io/devcontainers/features/git:1": {
30+
"version": "latest",
31+
"ppa": "false"
32+
},
33+
"ghcr.io/devcontainers/features/git-lfs:1": {
34+
"version": "latest"
35+
},
36+
"ghcr.io/devcontainers/features/github-cli:1": {
37+
"version": "latest"
38+
},
39+
"ghcr.io/devcontainers/features/docker-in-docker:2": {
40+
"version": "latest"
41+
},
42+
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {
43+
"version": "latest"
44+
},
45+
"ghcr.io/devcontainers/features/go:1": {
46+
"version": "latest"
47+
},
48+
"ghcr.io/devcontainers-contrib/features/neovim-apt-get:1": {},
49+
"ghcr.io/devcontainers-contrib/features/vscode-server:1": {}
50+
},
51+
"runArgs": ["--device=/dev/net/tun"],
52+
"customizations": {
53+
"vscode": {
54+
"extensions": ["npv2k1.theme-dracula-gray", "ms-azuretools.vscode-docker"]
55+
}
56+
},
57+
58+
// Features to add to the dev container. More info: https://containers.dev/features.
59+
// "features": {},
60+
61+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
62+
// "forwardPorts": [],
63+
64+
// Use 'postCreateCommand' to run commands after the container is created.
65+
// "postCreateCommand": "uname -a",
66+
67+
// Configure tool-specific properties.
68+
// "customizations": {},
69+
70+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
71+
"remoteUser": "openvscode-server"
72+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM mcr.microsoft.com/devcontainers/base:jammy
2+
3+
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
"ghcr.io/devcontainers/features/terraform:1": {},
13+
"ghcr.io/devcontainers/features/aws-cli:1": {},
14+
"ghcr.io/devcontainers/features/azure-cli:1":{},
15+
"ghcr.io/dhoeric/features/google-cloud-cli:1":{},
16+
// "./local-features/ubuntu-dev": "latest"
17+
},
18+
"runArgs": ["--device=/dev/net/tun"]
19+
20+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
21+
// "forwardPorts": [],
22+
23+
// Use 'postCreateCommand' to run commands after the container is created.
24+
// "postCreateCommand": "uname -a",
25+
26+
// Configure tool-specific properties.
27+
// "customizations": {},
28+
29+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
30+
// "remoteUser": "root"
31+
}

templates/terraform/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build:
2+
devcontainer build --workspace-folder .

0 commit comments

Comments
 (0)