-
Notifications
You must be signed in to change notification settings - Fork 323
78 lines (69 loc) · 2.56 KB
/
Copy pathdocker-devcontainer.yml
File metadata and controls
78 lines (69 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Build and push the Docker image for GitHub Codespaces
# - Only pushes if push or release
# - Builds without push for PRs to check the Dockerfile
name: Build Docker [devcontainers]
on:
pull_request: # Build, don't push
paths:
- ".devcontainer/**"
- ".github/workflows/docker-devcontainer.yml"
push: { branches: [master] } # Build + push ('latest' tag)
release: { types: [published] } # Build + push (release tag)
workflow_dispatch: # Build + push (custom tag)
inputs:
tag_name:
description: "Docker image tag name"
type: string
required: true
permissions:
contents: read
jobs:
build_push:
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
- name: Set tag variable
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
DISPATCH_TAG: ${{ inputs.tag_name }}
run: |
if [[ "$GITHUB_EVENT_NAME" == 'release' ]]; then
echo "IMAGE_TAG=$RELEASE_TAG" >> "$GITHUB_ENV"
elif [[ "$GITHUB_EVENT_NAME" == 'workflow_dispatch' ]]; then
echo "IMAGE_TAG=$DISPATCH_TAG" >> "$GITHUB_ENV"
else
echo "IMAGE_TAG=latest" >> "$GITHUB_ENV"
fi
- name: Check out the repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up QEMU for multi-architecture builds
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
- name: Setup Docker buildx for multi-architecture builds
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
with:
use: true
- name: Login to GitHub Container Registry
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pre-build dev container image
uses: devcontainers/ci@b63b30de439b47a52267f241112c5b453b673db5 # v0.3.1900000449
env:
BUILDX_NO_DEFAULT_ATTESTATIONS: true
with:
configFile: .devcontainer/codespaces-dev/devcontainer.json
imageName: ghcr.io/${{ github.repository }}
imageTag: ${{ env.IMAGE_TAG }}
cacheFrom: ghcr.io/${{ github.repository }}
platform: linux/amd64,linux/arm64
push: filter
eventFilterForPush: |
push
release
workflow_dispatch