Skip to content

Commit 1c50e27

Browse files
authored
Fix docker build/push with lowercase GH repo (#66)
Add labels for Docker container Give permissions to read from packages (ghcr.io)
1 parent 8fba9eb commit 1c50e27

4 files changed

Lines changed: 32 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ concurrency:
1616

1717
permissions:
1818
contents: read
19+
packages: read
1920

2021
jobs:
2122
test:
2223
name: python
2324
runs-on: ubuntu-latest
2425
container:
2526
image: registry.opensuse.org/documentation/containers/15.6/opensuse-daps-toolchain:latest
27+
# image: ghcr.io/opensuse/docbuild/daps:latest
2628

2729
steps:
2830
- name: Checkout repository

.github/workflows/docker-ci-publish.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,23 @@ jobs:
2727
username: ${{ github.actor }}
2828
password: ${{ secrets.GITHUB_TOKEN }}
2929

30+
- name: Set lowercase repository name
31+
id: repo
32+
run: echo "repo=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
33+
3034
- name: Build Docker image
35+
env:
36+
DOCKER_BUILDKIT: 1
3137
run: |
32-
docker build -f ci/Dockerfile -t ghcr.io/${{ github.repository }}/daps:${{ github.sha }} .
38+
docker build -f ci/Dockerfile -t ghcr.io/${{ steps.repo.outputs.repo }}/daps:${{ github.sha }} .
3339
3440
- name: Push Docker image
3541
run: |
36-
docker push ghcr.io/${{ github.repository }}/daps:${{ github.sha }}
42+
docker push ghcr.io/${{ steps.repo.outputs.repo }}/daps:${{ github.sha }}
3743
3844
# (Optional) Tag as latest if on main
3945
- name: Tag latest image
4046
if: github.ref == 'refs/heads/main'
4147
run: |
42-
docker tag ghcr.io/${{ github.repository }}/daps:${{ github.sha }} ghcr.io/${{ github.repository }}/daps:latest
43-
docker push ghcr.io/${{ github.repository }}/daps:latest
48+
docker tag ghcr.io/${{ steps.repo.outputs.repo }}/daps:${{ github.sha }} ghcr.io/${{ steps.repo.outputs.repo }}/daps:latest
49+
docker push ghcr.io/${{ steps.repo.outputs.repo }}/daps:latest

changelog.d/66.infra.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix docker build/push with lowercase GH repo

ci/Dockerfile

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ ARG URL=https://download.opensuse.org/repositories
88

99
FROM opensuse/leap:${OPENSUSE_VERSION} AS build
1010

11+
1112
# Add the Documentation:Tools OBS repository and refresh
1213
RUN zypper ar -f ${URL}/Documentation:/Tools/'$releasever' Documentation_Tools ; \
1314
zypper --gpg-auto-import-keys --non-interactive refresh
1415

1516
# Now install all required packages (from default + custom repo)
1617
RUN zypper --non-interactive install --no-recommends \
17-
curl ca-certificates sgml-skel gzip gpg2 \
18+
curl ca-certificates sgml-skel gzip optipng \
1819
google-noto-sans-jp-regular-fonts google-noto-sans-jp-bold-fonts \
1920
google-noto-sans-sc-regular-fonts google-noto-sans-sc-bold-fonts \
2021
google-noto-sans-kr-regular-fonts google-noto-sans-kr-bold-fonts \
@@ -57,13 +58,29 @@ RUN rpm --erase --nodeps adwaita-icon-theme \
5758
hicolor-icon-theme libreoffice-branding-openSUSE \
5859
libreoffice-icon-themes || true
5960

61+
6062
###############################################################################
6163
# 2. Runtime stage: Minimal image with only daps and its dependencies
6264
###############################################################################
6365
FROM opensuse/leap:${OPENSUSE_VERSION}
6466

65-
LABEL maintainer="Tom Schraitle"
67+
ARG DAPS_VERSION=4.0beta10
68+
ARG GEEKODOC_VERSION=2.3.1.1
69+
ARG SUSE_XSL_VERSION=2.95.12
70+
71+
LABEL org.opencontainers.image.vendor="openSUSE"
72+
LABEL org.opencontainers.image.title="DAPS CI Image"
73+
LABEL org.opencontainers.image.description="Minimal openSUSE Leap-based image for DAPS and documentation building (used in CI/CD)."
74+
LABEL org.opencontainers.image.version="1.0.0"
75+
LABEL org.opencontainers.image.url="https://github.com/openSUSE/docbuild"
6676
LABEL org.opencontainers.image.source="https://github.com/openSUSE/docbuild"
77+
LABEL org.opencontainers.image.licenses="GPL-2.0-or-later"
78+
LABEL org.opencontainers.image.authors="Tom Schraitle <[email protected]>"
79+
# Custom component labels
80+
LABEL com.opensuse.docbuild.daps.version="${DAPS_VERSION}"
81+
LABEL com.opensuse.docbuild.suse-xsl-stylesheets="${SUSE_XSL_VERSION}"
82+
LABEL com.opensuse.docbuild.geekodoc.version="${GEEKODOC_VERSION}"
83+
6784

6885
# Copy daps and suse-xsl-stylesheets from build stage
6986
COPY --from=build /usr /usr

0 commit comments

Comments
 (0)