test docker builds for all pushes and prs

This commit is contained in:
Laura Batalha 2025-05-04 00:31:16 +01:00
parent bf6559de05
commit 744f6b55e9
No known key found for this signature in database
GPG key ID: FF87260D8C08DA64
4 changed files with 17 additions and 35 deletions

View file

@ -99,8 +99,8 @@ jobs:
fail_on_unmatched_files: true fail_on_unmatched_files: true
build-containers-release: build-containers-release:
needs: release #needs: test
if: startsWith(github.ref, 'refs/tags/') #if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
packages: write packages: write
@ -129,6 +129,7 @@ jobs:
registry: ghcr.io registry: ghcr.io
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
# # Uncomment to use QEMU emulation, if rarer architectures are needed
# - name: Set up QEMU # - name: Set up QEMU
# uses: docker/setup-qemu-action@v3 # uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx - name: Set up Docker Buildx
@ -137,14 +138,6 @@ jobs:
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
path: .artifacts path: .artifacts
# - name: Build and push
# uses: docker/build-push-action@v6
# with:
# context: .git st
# file: docker/Dockerfile.dist
# platforms: linux/amd64,linux/arm64
# push: true
# tags: ${{ env.REGISTRY_IMAGE }}
- name: Build and push by digest - name: Build and push by digest
id: build id: build
@ -172,7 +165,7 @@ jobs:
retention-days: 1 retention-days: 1
container-manifest-merge: container-manifest-merge:
if: startsWith(github.ref, 'refs/tags/') #if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
packages: write packages: write
@ -203,6 +196,8 @@ jobs:
images: ${{ env.REGISTRY_IMAGE }} images: ${{ env.REGISTRY_IMAGE }}
tags: | tags: |
type=ref,event=tag type=ref,event=tag
type=ref,event=pr
type=ref,event=push
type=semver,pattern={{version}} type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}}.{{minor}}

View file

@ -1,10 +1,16 @@
FROM python:3.13-alpine FROM python:3.13-alpine AS build
RUN apk add --no-cache build-base linux-headers libffi-dev libressl-dev cargo
ENV PIP_ROOT_USER_ACTION=ignore ENV PIP_ROOT_USER_ACTION=ignore
ENV PIP_DISABLE_PIP_VERSION_CHECK=1 ENV PIP_DISABLE_PIP_VERSION_CHECK=1
ENV PIP_NO_CACHE_DIR=1 ENV PIP_NO_CACHE_DIR=1
RUN pip install rns RUN pip install rns
FROM python:3.13-alpine
COPY --from=build /usr/local/bin/ /usr/local/bin/
RUN mkdir /config RUN mkdir /config
RUN addgroup -S rns --gid 1000 && adduser -S rns --uid 1000 -G rns dialout RUN addgroup -S rns --gid 1000 && adduser -S rns --uid 1000 -G rns dialout

View file

@ -1,21 +0,0 @@
FROM python:3.13-alpine
ADD .artifacts/package/dist/rns-*.whl /tmp/
ENV PIP_ROOT_USER_ACTION=ignore
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
ENV PIP_NO_CACHE_DIR=1
RUN pip install /tmp/rns-*.whl
RUN mkdir /config
RUN addgroup -S rns --gid 1000 && adduser -S rns --uid 1000 -G rns dialout
RUN chown rns:rns /config
USER rns:rns
VOLUME ["/config"]
ENV PYTHONUNBUFFERED=1
ENTRYPOINT ["/usr/local/bin/rnsd", "--config", "/config"]

View file

@ -1,11 +1,13 @@
FROM python:3.13-alpine as build FROM python:3.13-alpine AS build
RUN apk add --no-cache build-base linux-headers libffi-dev libressl-dev cargo RUN apk add --no-cache build-base linux-headers libffi-dev libressl-dev cargo
ADD .artifacts/package/rns-*.whl /tmp/
ENV PIP_ROOT_USER_ACTION=ignore ENV PIP_ROOT_USER_ACTION=ignore
ENV PIP_DISABLE_PIP_VERSION_CHECK=1 ENV PIP_DISABLE_PIP_VERSION_CHECK=1
ENV PIP_NO_CACHE_DIR=1 ENV PIP_NO_CACHE_DIR=1
RUN pip install rns RUN pip install /tmp/rns-*.whl
FROM python:3.13-alpine FROM python:3.13-alpine