-
Notifications
You must be signed in to change notification settings - Fork 22
Make the images available in ghcr.io #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
name: Build and Push Docker Image to GHCR | ||
|
||
on: push | ||
|
||
permissions: | ||
contents: read # Required to checkout the repo code | ||
packages: write # Required to push packages to GHCR | ||
|
||
jobs: | ||
xcp-ng-build-env-82: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: docker/setup-buildx-action@v3 | ||
with: | ||
driver: docker-container | ||
- uses: docker/login-action@v3 | ||
if: github.ref == 'refs/heads/master' | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} # Uses the GitHub user/org name that triggered the workflow | ||
password: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub | ||
- uses: docker/build-push-action@v5 # Using v5 for latest features | ||
with: | ||
context: . | ||
file: ./Dockerfile-8.x | ||
push: ${{ github.ref == 'refs/heads/master' }} | ||
tags: ghcr.io/${{ github.repository }}:8.2 | ||
cache-from: type=gha,scope=${{ github.ref_name }}-82 # Cache layers to speed up builds | ||
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-82 # Store layers in cache for future builds | ||
build-args: | | ||
XCP_NG_BRANCH=8.2 | ||
platforms: | | ||
linux/amd64 | ||
|
||
xcp-ng-build-env-83: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: docker/setup-buildx-action@v3 | ||
with: | ||
driver: docker-container | ||
- uses: docker/login-action@v3 | ||
if: github.ref == 'refs/heads/master' | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} # Uses the GitHub user/org name that triggered the workflow | ||
password: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub | ||
- uses: docker/build-push-action@v5 # Using v5 for latest features | ||
with: | ||
context: . | ||
file: ./Dockerfile-8.x | ||
push: ${{ github.ref == 'refs/heads/master' }} | ||
tags: ghcr.io/${{ github.repository }}:8.3 | ||
cache-from: type=gha,scope=${{ github.ref_name }}-83 # Cache layers to speed up builds | ||
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-83 # Store layers in cache for future builds | ||
platforms: | | ||
linux/amd64 | ||
|
||
# TODO: uncomment once we have a public xcp-ng 9.0 repository | ||
# xcp-ng-build-env-90: | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - uses: actions/checkout@v4 | ||
# - uses: docker/setup-buildx-action@v3 | ||
# with: | ||
# driver: docker-container | ||
# - uses: docker/login-action@v3 | ||
# if: github.ref == 'refs/heads/master' | ||
# with: | ||
# registry: ghcr.io | ||
# username: ${{ github.actor }} # Uses the GitHub user/org name that triggered the workflow | ||
# password: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub | ||
# - uses: docker/build-push-action@v5 # Using v5 for latest features | ||
# with: | ||
# context: . | ||
# file: ./Dockerfile-9.x | ||
# platforms: | | ||
# linux/amd64/v2 | ||
Comment on lines
+78
to
+79
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Explicit platform for 8.x likely does not hurt, if only for documentation purposes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. but for 8.x, the arch is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. indeed, fixed! |
||
# push: ${{ github.ref == 'refs/heads/master' }} | ||
# tags: ghcr.io/${{ github.repository }}:9.0 | ||
# cache-from: type=gha,scope=${{ github.ref_name }}-90 # Cache layers to speed up builds | ||
# cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-90 # Store layers in cache for future builds |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
FROM ghcr.io/almalinux/10-base:10.0 | ||
|
||
ARG CUSTOM_BUILDER_UID="" | ||
ARG CUSTOM_BUILDER_GID="" | ||
|
||
# Add our repositories | ||
# temporary bootstrap repository | ||
COPY files/xcp-ng-8.99.repo /etc/yum.repos.d/xcp-ng.repo | ||
|
@@ -13,10 +10,9 @@ COPY files/Alma10-devel.repo /etc/yum.repos.d/ | |
RUN curl -sSf https://xcp-ng.org/RPM-GPG-KEY-xcpng -o /etc/pki/rpm-gpg/RPM-GPG-KEY-xcpng | ||
|
||
# Update | ||
RUN dnf update -y | ||
|
||
# Common build requirements | ||
RUN dnf install -y \ | ||
RUN dnf update -y \ | ||
# Common build requirements | ||
&& dnf install -y \ | ||
gcc \ | ||
gcc-c++ \ | ||
git \ | ||
|
@@ -26,54 +22,44 @@ RUN dnf install -y \ | |
python3-rpm \ | ||
sudo \ | ||
dnf-plugins-core \ | ||
epel-release | ||
|
||
# EPEL: needs epel-release installed first | ||
RUN dnf install -y \ | ||
epel-release \ | ||
# EPEL: needs epel-release installed first | ||
&& dnf install -y \ | ||
ydirson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
epel-rpm-macros \ | ||
almalinux-git-utils | ||
|
||
# Niceties | ||
RUN dnf install -y \ | ||
almalinux-git-utils \ | ||
# Niceties | ||
&& dnf install -y \ | ||
bash-completion \ | ||
vim \ | ||
wget \ | ||
which | ||
|
||
# clean package cache to avoid download errors | ||
RUN yum clean all | ||
|
||
# -release*, to be commented out to boostrap the build-env until it gets built | ||
# FIXME: isn't it already pulled as almalinux-release when available? | ||
RUN dnf install -y \ | ||
which \ | ||
# -release*, to be commented out to boostrap the build-env until it gets built | ||
# FIXME: isn't it already pulled as almalinux-release when available? | ||
&& dnf install -y \ | ||
xcp-ng-release \ | ||
xcp-ng-release-presets | ||
xcp-ng-release-presets \ | ||
# clean package cache to avoid download errors | ||
&& yum clean all | ||
|
||
# enable repositories commonly required to build | ||
RUN dnf config-manager --enable crb | ||
|
||
# workaround sudo not working (e.g. in podman 4.9.3 in Ubuntu 24.04) | ||
RUN chmod 0400 /etc/shadow | ||
|
||
# Set up the builder user | ||
RUN bash -c ' \ | ||
OPTS=(); \ | ||
if [ -n "${CUSTOM_BUILDER_UID}" ]; then \ | ||
OPTS+=("-u" "${CUSTOM_BUILDER_UID}"); \ | ||
fi; \ | ||
if [ -n "${CUSTOM_BUILDER_GID}" ]; then \ | ||
OPTS+=("-g" "${CUSTOM_BUILDER_GID}"); \ | ||
if ! getent group "${CUSTOM_BUILDER_GID}" >/dev/null; then \ | ||
groupadd -g "${CUSTOM_BUILDER_GID}" builder; \ | ||
fi; \ | ||
fi; \ | ||
useradd "${OPTS[@]}" builder; \ | ||
' \ | ||
# create the builder user | ||
RUN groupadd -g 1000 builder \ | ||
&& useradd -u 1000 -g 1000 builder \ | ||
&& echo "builder:builder" | chpasswd \ | ||
&& echo "builder ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers | ||
|
||
RUN mkdir -p /usr/local/bin | ||
RUN curl -fsSL "https://github.com/tianon/gosu/releases/download/1.17/gosu-amd64" -o /usr/local/bin/gosu \ | ||
&& chmod +x /usr/local/bin/gosu | ||
COPY files/init-container.sh /usr/local/bin/init-container.sh | ||
|
||
COPY files/entrypoint.sh /usr/local/bin/entrypoint.sh | ||
# FIXME: check it we really need any of this | ||
# COPY files/rpmmacros /home/builder/.rpmmacros | ||
# COPY --chown=builder:builder files/rpmmacros /home/builder/.rpmmacros | ||
|
||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] | ||
CMD ["bash"] | ||
Comment on lines
+64
to
+65
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This actually seems to overlap with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've used There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's often done to override There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes there are things in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We likely want those official floating tags to be set only when run on
master
, maybe we set particular tags for PRs?Also, timestamped tags as is common may be interesting to have.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workflow is only configured on master.
Other tags may be useful, as well as building for PRs, but we must consider cleaning up the old images.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it seems to be configured for
main
instead :)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, there would be a reason for allowing it to run not just on master: detecting pipeline errors before they reach
master
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, that would be nice. Maybe push to the registry when on the master branch then.