Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/build-container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Container Build
# Identical to build-push.yaml; but executed on pull requests
# where the quay secret is not available, to test that we can
# build the containers using the `redhat-actions/buildah-build`
# action.
on:
pull_request:

jobs:
build:
name: Build container images
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
# Fetch enough commit info to feed version generator
fetch-depth: 10
- uses: actions/setup-python@v4
with:
python-version: "3.12"
- uses: Gr1N/setup-poetry@v9
- name: Install dependencies
run: |
cd backend
poetry install

- name: Build Frontend Image
id: build-front
uses: redhat-actions/buildah-build@v2
with:
image: frontend
context: frontend
tags: latest ${{ github.sha }}
containerfiles: |
./frontend/frontend.containerfile

- name: Generate version file
run: |
cd backend
poetry run scripts/version.py

- name: Build Backend Image
id: build-back
run: |
cd backend
podman build -t backend:${{ github.sha }} -t backend:latest -f backend.containerfile .
11 changes: 3 additions & 8 deletions .github/workflows/build-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,9 @@ jobs:

- name: Build Backend Image
id: build-back
uses: redhat-actions/buildah-build@v2
with:
image: backend
context: backend
tags: latest ${{ github.sha }}
containerfiles: |
./backend/backend.containerfile

run: |
cd backend
podman build -t backend:${{ github.sha }} -t backend:latest -f backend.containerfile .
- name: Push backend image to quay.io
id: push-back-to-quay
uses: redhat-actions/push-to-registry@v2
Expand Down
10 changes: 3 additions & 7 deletions .github/workflows/release-build-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,9 @@ jobs:

- name: Build Backend Image
id: build-back
uses: redhat-actions/buildah-build@v2
with:
image: backend
context: backend
tags: prod ${{ github.sha }}
containerfiles: |
./backend/backend.containerfile
run: |
cd backend
podman build -t backend:${{ github.sha }} -t backend:prod -f backend.containerfile .

- name: Push backend image to quay.io
id: push-back-to-quay
Expand Down
13 changes: 10 additions & 3 deletions backend/backend.containerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
FROM quay.io/centos/centos:stream10
FROM quay.io/centos/centos:stream9

# 0) Configure Poetry and environment for OpenShift non-root execution
ENV POETRY_VIRTUALENVS_CREATE=false \
HOME=/backend \
XDG_CONFIG_HOME=/backend/.config \
XDG_CACHE_HOME=/backend/.cache

RUN dnf update -y
RUN dnf install -y 'dnf-command(config-manager)'
RUN dnf config-manager --set-enabled crb
RUN dnf install -y epel-release epel-next-release
RUN dnf install -y python3.12 python3.12-devel python3.12-pip gcc gcc-c++

RUN ln -sf /usr/bin/python3.12 /usr/bin/python3 && ln -sf /usr/bin/pip3.12 /usr/bin/pip3

# 1) Install system deps + Poetry globally (root)
# Installing Poetry globally ensures the binary is on /usr/local/bin
# and therefore available in both OpenShift (random UID) and Podman (root) environments
RUN dnf install -y python3-pip gcc python3-devel gcc-c++ && \
pip3 install --no-cache-dir poetry && \
RUN pip3 install --no-cache-dir poetry && \
dnf clean all

# 2) Prepare writable dirs
Expand Down
12 changes: 9 additions & 3 deletions testing/functional.containerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/centos/centos:stream10
FROM quay.io/centos/centos:stream9

ENV PATH=/root/.local/bin:$PATH \
LANG=C.UTF-8 \
Expand All @@ -16,9 +16,15 @@ WORKDIR /backend
RUN mkdir -p ${HOME} ${HOME}/.config/pypoetry ${HOME}/.cache/pypoetry && \
chmod -R g+rwX ${HOME}

RUN dnf install -y pip gcc python3-devel gcc-c++
RUN dnf update -y
RUN dnf install -y 'dnf-command(config-manager)'
RUN dnf config-manager --set-enabled crb
RUN dnf install -y epel-release epel-next-release
RUN dnf install -y python3.12 python3.12-devel python3.12-pip gcc gcc-c++

RUN pip install --user poetry
RUN ln -sf /usr/bin/python3.12 /usr/bin/python3 && ln -sf /usr/bin/pip3.12 /usr/bin/pip3

RUN pip3 install --user poetry

# 3) Copy manifest files & install Python deps via export
COPY backend/pyproject.toml backend/poetry.lock backend/version.json ./
Expand Down
Loading