ci: use public gha runners #179
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: [ main ] | |
workflow_dispatch: | |
name: Build container images | |
jobs: | |
build: | |
name: Build ${{ matrix.tag }} | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- tag: cyberlandslaget/kriger | |
path: . | |
- tag: cyberlandslaget/kriger-frontend | |
path: frontend | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: ${{ matrix.path }} | |
file: ${{ matrix.path }}/Dockerfile | |
push: true | |
tags: ghcr.io/${{ matrix.tag }}:main,ghcr.io/${{ matrix.tag }}:main-${{ github.run_number }} | |
cache-from: type=registry,ref=ghcr.io/${{ matrix.tag }}:buildcache | |
cache-to: type=registry,ref=ghcr.io/${{ matrix.tag }}:buildcache,mode=max | |
build_exploit_base: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- tag: cyberlandslaget/kriger-exploit-base:python | |
path: data/base/python | |
- tag: cyberlandslaget/kriger-exploit-base:python-slim | |
path: data/base/python-slim | |
name: Build exploit base ${{ matrix.tag }} | |
runs-on: self-hosted | |
permissions: | |
contents: read | |
packages: write | |
needs: [ build ] | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: ${{ matrix.path }} | |
file: ${{ matrix.path }}/Dockerfile | |
push: true | |
tags: ghcr.io/${{ matrix.tag }} | |
cache-from: type=registry,ref=ghcr.io/${{ matrix.tag }}:buildcache | |
cache-to: type=registry,ref=ghcr.io/${{ matrix.tag }}:buildcache,mode=max |