Skip to content

Commit cafe9ed

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 cafe9ed

2 files changed

Lines changed: 66 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 42 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,44 @@ 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]
85+
#[amd64, arm64]
86+
87+
steps:
88+
- name: Checkout commit
89+
uses: actions/checkout@v6
90+
with:
91+
sparse-checkout: |
92+
src/oci
93+
sparse-checkout-cone-mode: false
94+
- uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup@main
95+
with:
96+
version: a309bd305837df98979ac5e3956248c377829e1a
97+
- name: Get the Git tag name
98+
id: get-tag-name
99+
run: echo "tag-name=${GITHUB_REF/refs\/tags\//}" | tee -a "$GITHUB_OUTPUT"
100+
- name: Create OCI container and release
101+
env:
102+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103+
run: |
104+
gl-oci build-container \
105+
--container "ghcr.io/${{ github.repository }}/container" \
106+
--tag "${{ steps.get-tag-name.outputs.tag-name }}" \
107+
--oci_archive "container_${{ matrix.arch }}.oci" \
108+
--platform linux/${{ matrix.arch }} \
109+
--dir "src/oci" \
110+
--build_arg GL_VERSION=$GL_VERSION \
111+
--build_arg PY_GL_VERSION="$snapshot"
112+
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # pin@v7.0.0
113+
with:
114+
name: container-${{ matrix.arch }}
115+
path: container_${{ matrix.arch }}.oci
116+
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)