Skip to content

Commit 847fbf2

Browse files
authored
Merge pull request #59 from stuartleeks/sl/use-devcontainer-build-run-action
Convert to devcontainer-build-run action
2 parents b8e5438 + 5d2349e commit 847fbf2

2 files changed

Lines changed: 28 additions & 14 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,8 @@
1414

1515
// Mount go mod cache
1616
"-v", "devcontainer-cli-gomodcache:/go/pkg",
17-
// Keep command history
18-
"-v", "devcontainer-cli-bashhistory:/root/commandhistory",
19-
// Mount docker socket for docker builds
20-
"-v", "/var/run/docker.sock:/var/run/docker.sock",
2117
// Use host network
2218
"--network=host",
23-
// Mount azure, git and docker config
24-
"-v", "${env:HOME}${env:USERPROFILE}/.azure:/root/.azure"
2519
],
2620

2721
// Set *default* container specific settings.json values on container create.
@@ -63,9 +57,15 @@
6357
// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
6458
"remoteUser": "vscode",
6559
"mounts": [
60+
// Keep command history
61+
"source=devcontainer-cli-bashhistory,target=/home/vscode/commandhistory",
6662
// Mounts the .config/gh host folder into the dev container to pick up host gh CLI login details
6763
// NOTE that mounting directly to ~/.config/gh makes ~/.config only root-writable
6864
// Instead monut to another location and symlink in Dockerfile
6965
"type=bind,source=${env:HOME}${env:USERPROFILE}/.config/gh,target=/config/gh",
66+
// Mounts the .azure host folder into the dev container to pick up host az CLI login details
67+
"type=bind,source=${env:HOME}${env:USERPROFILE}/.azure,target=/home/vscode/.azure",
68+
// Mount host docker socket
69+
"type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock",
7070
],
7171
}

.github/workflows/build-and-release.yaml

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,31 @@ jobs:
1919
steps:
2020
- uses: actions/checkout@v2
2121

22-
- name: CI Tooling
23-
run: sudo apt update && sudo apt install build-essential -y
24-
25-
- name: Build devcontainer for tooling
26-
run: sudo -E make devcontainer
22+
- name: Set up Docker BuildKit
23+
uses: docker/setup-buildx-action@v1
2724

28-
- name: Run the release
29-
run: sudo -E make devcontainer-release
25+
- name: Login to GitHub Container Registry
26+
uses: docker/login-action@v1
27+
with:
28+
registry: ghcr.io
29+
username: ${{ github.repository_owner }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Build and run CLI
33+
uses: stuartleeks/devcontainer-build-run@v0.1-alpha
3034
env:
3135
GITHUB_TOKEN: ${{ secrets.GH_CROSS_REPO_TOKEN }}
3236
BUILD_NUMBER: ${{ github.run_id }}
33-
IS_CI: 1
3437
IS_PR: ${{ github.head_ref }}
3538
BRANCH: ${{ github.ref }}
39+
with:
40+
imageName: ghcr.io/stuartleeks/devcontainer-cli-devcontainer
41+
runCmd: |
42+
sudo chown -R $(whoami) /go/pkg
43+
./scripts/ci_release.sh
44+
env: |
45+
GITHUB_TOKEN
46+
BUILD_NUMBER
47+
IS_CI=1
48+
IS_PR
49+
BRANCH

0 commit comments

Comments
 (0)