Skip to content

Commit 87724c2

Browse files
committed
Use ghcr.io to store the images
Signed-off-by: Gaëtan Lehmann <[email protected]>
1 parent 6b876c8 commit 87724c2

File tree

3 files changed

+81
-2
lines changed

3 files changed

+81
-2
lines changed

.github/workflows/docker.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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+
36+
xcp-ng-build-env-83:
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v4
40+
- uses: docker/setup-buildx-action@v3
41+
with:
42+
driver: docker-container
43+
- uses: docker/login-action@v3
44+
with:
45+
registry: ghcr.io
46+
username: ${{ github.actor }} # Uses the GitHub user/org name that triggered the workflow
47+
password: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub
48+
- uses: docker/build-push-action@v5 # Using v5 for latest features
49+
with:
50+
context: .
51+
file: ./Dockerfile-8.x
52+
push: true
53+
tags: ghcr.io/${{ github.repository }}:8.3
54+
cache-from: type=gha,scope=${{ github.ref_name }}-83 # Cache layers to speed up builds
55+
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-83 # Store layers in cache for future builds
56+
57+
# TODO: uncomment once we have a public xcp-ng 9.0 repository
58+
# xcp-ng-build-env-90:
59+
# runs-on: ubuntu-latest
60+
# steps:
61+
# - uses: actions/checkout@v4
62+
# - uses: docker/setup-buildx-action@v3
63+
# with:
64+
# driver: docker-container
65+
# - uses: docker/login-action@v3
66+
# with:
67+
# registry: ghcr.io
68+
# username: ${{ github.actor }} # Uses the GitHub user/org name that triggered the workflow
69+
# password: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub
70+
# - uses: docker/build-push-action@v5 # Using v5 for latest features
71+
# with:
72+
# context: .
73+
# file: ./Dockerfile-9.x
74+
# platforms: |
75+
# linux/amd64/v2
76+
# push: true
77+
# tags: ghcr.io/${{ github.repository }}:9.0
78+
# cache-from: type=gha,scope=${{ github.ref_name }}-90 # Cache layers to speed up builds
79+
# cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-90 # Store layers in cache for future builds

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ esac
9292
"$RUNNER" build \
9393
--platform "$PLATFORM" \
9494
"${CUSTOM_ARGS[@]}" \
95-
-t xcp-ng/xcp-ng-build-env:${1} \
95+
-t ghcr.io/xcp-ng/xcp-ng-build-env:${1} \
9696
--build-arg XCP_NG_BRANCH=${1} \
9797
--ulimit nofile=1024 \
9898
-f $DOCKERFILE .

run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import sys
1515
import uuid
1616

17-
CONTAINER_PREFIX = "xcp-ng/xcp-ng-build-env"
17+
CONTAINER_PREFIX = "ghcr.io/xcp-ng/xcp-ng-build-env"
1818

1919
DEFAULT_BRANCH = '8.3'
2020
DEFAULT_ULIMIT_NOFILE = 2048

0 commit comments

Comments
 (0)