Skip to content

Commit d779c05

Browse files
committed
Use ghcr.io to store the images
Signed-off-by: Gaëtan Lehmann <gaetan.lehmann@vates.tech>
1 parent 9911447 commit d779c05

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

.github/workflows/docker.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Build and Push Docker Image to GHCR
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: read # Required to checkout the repo code
10+
packages: write # Required to push packages to GHCR
11+
12+
jobs:
13+
xcp-ng-build-env-82:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: docker/setup-buildx-action@v3
18+
with:
19+
driver: docker-container
20+
- uses: docker/login-action@v3
21+
with:
22+
registry: ghcr.io
23+
username: ${{ github.actor }} # Uses the GitHub user/org name that triggered the workflow
24+
password: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub
25+
- uses: docker/build-push-action@v5 # Using v5 for latest features
26+
with:
27+
context: .
28+
file: ./Dockerfile-8.x
29+
push: true
30+
tags: ghcr.io/${{ github.repository }}:8.2
31+
cache-from: type=gha,scope=${{ github.ref_name }}-82 # Cache layers to speed up builds
32+
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-82 # Store layers in cache for future builds
33+
build-args: |
34+
XCP_NG_BRANCH=8.2
35+
platforms: |
36+
linux/amd64/v2
37+
38+
xcp-ng-build-env-83:
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v4
42+
- uses: docker/setup-buildx-action@v3
43+
with:
44+
driver: docker-container
45+
- uses: docker/login-action@v3
46+
with:
47+
registry: ghcr.io
48+
username: ${{ github.actor }} # Uses the GitHub user/org name that triggered the workflow
49+
password: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub
50+
- uses: docker/build-push-action@v5 # Using v5 for latest features
51+
with:
52+
context: .
53+
file: ./Dockerfile-8.x
54+
push: true
55+
tags: ghcr.io/${{ github.repository }}:8.3
56+
cache-from: type=gha,scope=${{ github.ref_name }}-83 # Cache layers to speed up builds
57+
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-83 # Store layers in cache for future builds
58+
platforms: |
59+
linux/amd64/v2
60+
61+
# TODO: uncomment once we have a public xcp-ng 9.0 repository
62+
# xcp-ng-build-env-90:
63+
# runs-on: ubuntu-latest
64+
# steps:
65+
# - uses: actions/checkout@v4
66+
# - uses: docker/setup-buildx-action@v3
67+
# with:
68+
# driver: docker-container
69+
# - uses: docker/login-action@v3
70+
# with:
71+
# registry: ghcr.io
72+
# username: ${{ github.actor }} # Uses the GitHub user/org name that triggered the workflow
73+
# password: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub
74+
# - uses: docker/build-push-action@v5 # Using v5 for latest features
75+
# with:
76+
# context: .
77+
# file: ./Dockerfile-9.x
78+
# platforms: |
79+
# linux/amd64/v2
80+
# push: true
81+
# tags: ghcr.io/${{ github.repository }}:9.0
82+
# cache-from: type=gha,scope=${{ github.ref_name }}-90 # Cache layers to speed up builds
83+
# cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-90 # Store layers in cache for future builds

0 commit comments

Comments
 (0)