Skip to content

Commit 739fef9

Browse files
committed
build devcontainer image on release tag
1 parent 3bf3de0 commit 739fef9

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions
2+
name: Publish Dev Container
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
tags:
9+
- v*
10+
workflow_dispatch:
11+
12+
env:
13+
REGISTRY: ghcr.io
14+
IMAGE_NAME: ${{ github.repository }}
15+
16+
jobs:
17+
build-and-push-image:
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
packages: write
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
27+
- name: Set up QEMU for multi-arch builds
28+
uses: docker/setup-qemu-action@v3
29+
30+
- name: Set up Docker Buildx
31+
id: buildx
32+
uses: docker/setup-buildx-action@v3
33+
34+
- name: Log in to the Container registry
35+
uses: docker/login-action@v3
36+
with:
37+
registry: ${{ env.REGISTRY }}
38+
username: ${{ github.actor }}
39+
password: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Extract metadata (tags, labels) for Docker
42+
id: meta
43+
uses: docker/metadata-action@v5
44+
with:
45+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
46+
47+
- name: Build and push Docker image
48+
uses: docker/build-push-action@v5
49+
with:
50+
builder: ${{ steps.buildx.outputs.name }}
51+
platforms: linux/amd64,linux/arm64
52+
context: ./devcontainer
53+
file: ./devcontainer/Dockerfile
54+
push: true
55+
provenance: false
56+
tags: ${{ steps.meta.outputs.tags }}
57+
labels: ${{ steps.meta.outputs.labels }}
58+
build-args: |
59+
VERSION=${{ github.sha }}

devcontainer/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ RUN sudo apt-get update && sudo apt install -y xz-utils acl
99

1010
RUN wget -O install.sh https://nixos.org/nix/install \
1111
&& chmod +x install.sh \
12+
&& mkdir -m 0755 /etc/nix \
13+
&& printf 'sandbox = false \nfilter-syscalls = false' > /etc/nix/nix.conf \
1214
&& addgroup --gid 30000 --system nixbld \
1315
&& for i in $(seq 1 30); do adduser --system --no-create-home --home /var/empty --uid $((30000 + i)) nixbld$i && adduser nixbld$i nixbld ; done \
1416
&& USER=root sh ./install.sh --daemon --no-channel-add --nix-extra-conf-file /nix.conf \

0 commit comments

Comments
 (0)