forked from code-server-boilerplates/starter-pack
-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (83 loc) · 3.24 KB
/
push-to-registry.yml
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
79
80
81
82
83
84
85
86
87
88
name: "Docker Builds CI (using official code-server images)"
on:
push:
branches: [ main ]
paths:
- "Dockerfile"
- "arm64.Dockerfile"
- ".trigger-rebuuld"
jobs:
test:
#matrix:
# archs supported by the official CDRS image
# arch: ["amd64", "arm64"]
runs-on: "ubuntu-latest"
steps:
- name: "Create checkmates"
uses: "actions/checkout@v2"
- name: Run tests
run: docker build . --file Dockerfile
publish:
needs: [ test ]
runs-on: "ubuntu-latest"
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- name: "Create checkmates"
uses: "actions/checkout@v2"
# Setup QEMU for multiarch builds
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
# and of course, we need to setup Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
driver-opts: "image=moby/buildkit:master,network=host"
# repeat this for other registries you want to use
# especially the official Docker Hub Registry
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
# change the username into yours if not using our bot
username: RecapTimeBot
# may not work on personal accounts if using our PAT
# we may try soon
password: ${{ secrets.GH_SERVICE_ACCOUNT_API_KEY }}
# after building, we may retag them for DockerHub instead
# of building again
- name: Build and push to GHCR + DockerHub (amd64)
id: build-amd64
uses: docker/build-push-action@v2
with:
push: true
# version mapping:
# - latest -> cdr-latest -> cdr-latest.debian10
# - cdr-3.9.3 -> cdr.3.9.3.debian10
tags: |
ghcr.io/code-server-boilerplates/starter-pack:cdr-latest
ghcr.io/code-server-boilerplates/starter-pack:cdr-latest.debian10
ghcr.io/code-server-boilerplates/starter-pack:latest
ghcr.io/code-server-boilerplates/starter-pack:cdr-3.9.3
ghcr.io/code-server-boilerplates/starter-pack:cdr-3.9.3.debian10
context: .
platforms: linux/amd64
- name: Echo imahe digest (amd64)
run: echo AMD64 image - ${{ steps.build_amd64.outputs.digest }}
# with an exception for arm64 builds
- name: Build and push to GHCR + DockerHub (arm64)
id: buuld-arm64
uses: docker/build-push-action@v2
with:
push: true
# see line 53 for notes regarding how we map versions into image tags
tags: |
ghcr.io/code-server-boilerplates/starter-pack:cdr-latest
ghcr.io/code-server-boilerplates/starter-pack:cdr-latest.debian10
ghcr.io/code-server-boilerplates/starter-pack:latest
ghcr.io/code-server-boilerplates/starter-pack:cdr-3.9.3
ghcr.io/code-server-boilerplates/starter-pack:cdr-3.9.3.debian10
context: .
platforms: linux/arm64
file: arm64.Dockerfile
- name: Echo image digest (arm64)
run: echo ARM64 image - ${{ steps.build_arm64.outputs.digest }}