Skip to content

Add instructions on using Docker. #117

Add instructions on using Docker.

Add instructions on using Docker. #117

Workflow file for this run

name: Build, Test & Publush
# Controls when the action will run.
on:
# Triggers the workflow on all push or pull request events
push:
pull_request:
release:
types: [created]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
# added using https://github.com/step-security/secure-repo
permissions:
contents: read
jobs:
build_in_docker:
name: Build&Push to Registry
runs-on: ubuntu-latest
permissions:
packages: write
strategy:
fail-fast: false
matrix:
base_image: ['debian:12-slim', 'ubuntu:latest']
env:
GHCR_REPO: ghcr.io/${{ github.repository_owner }}/qemu-bsd-user-l4b
BASE_IMAGE: ${{ matrix.base_image }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set dynamic environment
run: |
GIT_BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
OS_TAG="`echo ${{ env.BASE_IMAGE }} | sed 's|:|-|g'`"
# linux/arm/v7 is missing latest clang
PLATFORMS="`docker manifest inspect ${{ env.BASE_IMAGE }} | \
jq -r '.manifests[] | "\(.platform.os)/\(.platform.architecture)\(if .platform.variant != null then "/\(.platform.variant)" else "" end)"' | \
sort -u | ./bsd-user/scripts/ci/get-arch-buildargs fltplatforms | paste -sd ','`"
echo "GIT_BRANCH=${GIT_BRANCH}" >> $GITHUB_ENV
echo "PLATFORMS=${PLATFORMS}" >> $GITHUB_ENV
echo "OS_TAG=${OS_TAG}" >> $GITHUB_ENV
echo "BUILD_IMAGE=${{ env.GHCR_REPO }}:latest-${OS_TAG}" >> $GITHUB_ENV
- name: Build L4B Qemu container image
uses: docker/build-push-action@v6
env:
CACHE_SPEC: "type=registry,ref=${{ env.GHCR_REPO }}:${{ env.GIT_BRANCH }}-${{ env.OS_TAG}}-buildcache"
with:
context: .
file: ./bsd-user/scripts/ci/Dockerfile
build-args: |
BASE_IMAGE=${{ env.BASE_IMAGE }}
tags: ${{ env.BUILD_IMAGE }}
platforms: ${{ env.PLATFORMS }}
push: true
cache-from: ${{ env.CACHE_SPEC }}
cache-to: ${{ env.CACHE_SPEC }},mode=max
- name: Register FreeBSD binfmt
run: |
docker run --rm --privileged ${{ env.BUILD_IMAGE }}
- name: Build FreeBSD/base container image
uses: docker/build-push-action@v6
with:
context: ./bsd-user/scripts/ci
file: ./bsd-user/scripts/ci/Dockerfile.FreeBSD_base
build-args: |
BASE_IMAGE=${{ env.BASE_IMAGE }}
BUILD_IMAGE=${{ env.BUILD_IMAGE }}
tags: "${{ env.BUILD_IMAGE }}-freebsd141"
platforms: ${{ env.PLATFORMS }}
push: true