Skip to content

Commit 16f2d5d

Browse files
committed
Add support to build release containers
Signed-off-by: Tobias Wolf <wolf@b1-systems.de> On-behalf-of: SAP <tobias.wolf@sap.com>
1 parent 276314f commit 16f2d5d

2 files changed

Lines changed: 65 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66

77
env:
88
GIT_CLIFF_VERSION: 2.12.0
9+
GL_VERSION: 2150.1.0
910

1011
jobs:
1112
docs:
@@ -72,3 +73,43 @@ jobs:
7273
--body "
7374
$(git-cliff -o - --current)
7475
"
76+
77+
create-oci-release:
78+
#if: ${{ github.ref_name == 'main' }}
79+
runs-on: ${{ matrix.arch == 'arm64' && 'ubuntu-latest-arm' || 'ubuntu-latest' }}
80+
permissions:
81+
contents: write
82+
strategy:
83+
matrix:
84+
arch: [amd64, arm64]
85+
86+
steps:
87+
- name: Checkout commit
88+
uses: actions/checkout@v6
89+
with:
90+
sparse-checkout: |
91+
src/oci
92+
sparse-checkout-cone-mode: false
93+
- uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup@main
94+
with:
95+
version: a309bd305837df98979ac5e3956248c377829e1a
96+
- name: Get the Git tag name
97+
id: get-tag-name
98+
run: echo "tag-name=${GITHUB_REF/refs\/tags\//}" | tee -a "$GITHUB_OUTPUT"
99+
- name: Create OCI container and release
100+
env:
101+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102+
run: |
103+
gl-oci build-container \
104+
--container "ghcr.io/${{ github.repository }}/container" \
105+
--tag "${{ steps.get-tag-name.outputs.tag-name }}" \
106+
--oci_archive "container_${{ matrix.arch }}.oci" \
107+
--platform linux/${{ matrix.arch }} \
108+
--dir "src/oci" \
109+
--build_arg GL_VERSION=$GL_VERSION \
110+
--build_arg PY_GL_VERSION="${{ steps.get-tag-name.outputs.tag-name }}"
111+
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # pin@v7.0.0
112+
with:
113+
name: container-${{ matrix.arch }}
114+
path: container_${{ matrix.arch }}.oci
115+
if-no-files-found: error

src/oci/Containerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
ARG GL_VERSION=2150.0.0
2+
ARG PY_GL_VERSION=0.10.20
3+
4+
FROM ghcr.io/gardenlinux/gardenlinux:${GL_VERSION} as installer
5+
6+
ARG PY_GL_VERSION
7+
ENV PY_GL_VERSION=${PY_GL_VERSION}
8+
9+
RUN apt-get update
10+
RUN apt-get install -y ca-certificates git python3 python3-pip
11+
RUN mkdir -p /opt/app
12+
RUN python3 -m venv --system-site-packages --without-pip /opt/app
13+
RUN /opt/app/bin/python -m pip install git+https://github.com/gardenlinux/python-gardenlinux-lib.git@${PY_GL_VERSION}
14+
15+
FROM ghcr.io/gardenlinux/gardenlinux:${GL_VERSION} as base
16+
LABEL org.opencontainers.image.source="https://github.com/gardenlinux/python-gardenlinux-lib"
17+
18+
RUN apt-get update
19+
RUN apt-get install -y podman python3
20+
21+
COPY --from=installer /opt/app /opt/app
22+
23+
WORKDIR /opt/app
24+
ENTRYPOINT ["/opt/app/bin/gl-oci"]

0 commit comments

Comments
 (0)