Skip to content
Open
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
23 changes: 23 additions & 0 deletions .github/workflows/build-multiarch-backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build and Push Multi-Arch Image
on: [push]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
on: [push]
on:
push:
branches:
- main

Looks like this currently runs for all branches. I think we should restrict it to main - especially if we plan to go "tagless" and rely on latest.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we also filter to only build if backend code changes (rare):

on:
  push:
    paths:
      - 'backend/**'
      - '.github/workflows/build-multiarch-backend.yml'

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Support click to run from github ui:

on:
  workflow_dispatch:
``

Also ^^ comments apply to frontend too


jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Quay
run: |
echo "${{ secrets.QUAY_TOKEN }}" | docker login quay.io -u "${{ secrets.QUAY_USER }}" --password-stdin
- name: Build and Push Multi-Arch Image
run: |
./plano --file backend/.plano.py build,push
23 changes: 23 additions & 0 deletions .github/workflows/build-multiarch-frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build and Push Multi-Arch Image
on: [push]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.


jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Quay
run: |
echo "${{ secrets.QUAY_TOKEN }}" | docker login quay.io -u "${{ secrets.QUAY_USER }}" --password-stdin
- name: Build and Push Multi-Arch Image
run: |
./plano --file frontend/.plano.py update-gesso,build,push
6 changes: 4 additions & 2 deletions backend/.plano.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
def build(no_cache=False):
no_cache_arg = "--no-cache" if no_cache else ""

run(f"podman build {no_cache_arg} --format docker -t {image_tag} .")
run(f"podman manifest rm {image_tag}", check=False)
run(f"podman rmi {image_tag}", check=False)
Comment on lines +28 to +29
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This addition is only needed true outside of a workflow.

run(f"podman build {no_cache_arg} --format docker --platform linux/amd64,linux/arm64,linux/s390x,linux/ppc64le --file backend/Containerfile --manifest {image_tag} ./backend")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense


@command
def run_():
Expand All @@ -38,4 +40,4 @@ def debug():
@command
def push():
run("podman login quay.io")
run(f"podman push {image_tag}")
run(f"podman manifest push {image_tag}")
2 changes: 1 addition & 1 deletion backend/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ FROM python:alpine AS run
RUN adduser -S fritz -G root
USER fritz

COPY --from=build /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
COPY --from=build /usr/local/lib/python3.14/site-packages /usr/local/lib/python3.14/site-packages
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just add a comment telling why inline.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as a review comment

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated python version in Containerfiles as tag alpine uses updated python v3.14

COPY --chown=fritz:root python /home/fritz/python

EXPOSE 8080
Expand Down
6 changes: 4 additions & 2 deletions frontend/.plano.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
def build(no_cache=False):
no_cache_arg = "--no-cache" if no_cache else ""

run(f"podman build {no_cache_arg} --format docker -t {image_tag} .")
run(f"podman manifest rm {image_tag}", check=False)
run(f"podman rmi {image_tag}", check=False)
Comment on lines +29 to +30
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as earlier... This addition is only needed true outside of a workflow.

run(f"podman build {no_cache_arg} --format docker --platform linux/amd64,linux/arm64,linux/s390x,linux/ppc64le --file frontend/Containerfile --manifest {image_tag} ./frontend")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense


@command
def run_():
Expand Down Expand Up @@ -57,7 +59,7 @@ def debug():
@command
def push():
run("podman login quay.io")
run(f"podman push {image_tag}")
run(f"podman manifest push {image_tag}")

@command
def update_gesso():
Expand Down
2 changes: 1 addition & 1 deletion frontend/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ FROM python:alpine AS run
RUN adduser -S fritz -G root
USER fritz

COPY --from=build /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
COPY --from=build /usr/local/lib/python3.14/site-packages /usr/local/lib/python3.14/site-packages
COPY --chown=fritz:root python /home/fritz/python
COPY --chown=fritz:root static /home/fritz/static

Expand Down