Skip to content

Commit

Permalink
Add separate docker file to build FreeBSD/base container.
Browse files Browse the repository at this point in the history
  • Loading branch information
sobomax committed Dec 26, 2024
1 parent f40e6c6 commit aa9d1fd
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
18 changes: 17 additions & 1 deletion .github/workflows/bsd-user.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
echo "OS_TAG=${OS_TAG}" >> $GITHUB_ENV
echo "BUILD_IMAGE=${{ env.GHCR_REPO }}:latest-${OS_TAG}" >> $GITHUB_ENV
- name: Build Docker image
- 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"
Expand All @@ -78,3 +78,19 @@ jobs:
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
26 changes: 26 additions & 0 deletions bsd-user/scripts/ci/Dockerfile.FreeBSD_base
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# syntax=docker/dockerfile:1.7-labs

ARG BASE_IMAGE="debian:sid-slim"
ARG BUILD_IMAGE="ghcr.io/sobomax/qemu-bsd-user-l4b:latest-debian-sid-slim"
FROM ${BASE_IMAGE} AS base
LABEL maintainer="Maksym Sobolyev <sobomax@FreeBSD.org>"

ARG DEBIAN_FRONTEND=noninteractive
ARG APT_INSTALL="apt-get install --no-install-recommends -y"
ARG APT_UPDATE="apt-get -y update -qq"
RUN ${APT_UPDATE}
ARG BUILD_PKGS="ca-certificates curl tar xz-utils"
RUN ${APT_INSTALL} ${BUILD_PKGS}

RUN mkdir -p /tmp/world
RUN curl -o - -L https://download.freebsd.org/releases/amd64/14.1-RELEASE/base.txz | \
tar -C /tmp/world --exclude ./sys -xJf -

ARG BUILD_IMAGE
FROM ${BUILD_IMAGE} as build
FROM scratch as image
ENV QEMU_BIN_DIR=/usr/bin
COPY --from=base /tmp/world /
COPY --from=build ${QEMU_BIN_DIR}/qemu-freebsd_x86_64-static ${QEMU_BIN_DIR}
RUN /bin/echo "Hello Docker! :^)"
ENTRYPOINT ["/bin/sh"]

0 comments on commit aa9d1fd

Please sign in to comment.