Skip to content

Commit 2e46b52

Browse files
committed
add base-core: Minimal FreeBSD base image without service supervision. Foundation for CLI tools and non-daemon containers.
0 parents  commit 2e46b52

10 files changed

Lines changed: 315 additions & 0 deletions

File tree

.daemonless/config.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
type: base
2+
build:
3+
auto_version: true
4+
architectures:
5+
- amd64
6+
variants:
7+
- tag: "15-pkg"
8+
args:
9+
PKG_BRANCH: quarterly
10+
aliases: ["latest"]
11+
- tag: "15-pkg-latest"
12+
args:
13+
PKG_BRANCH: latest
14+
15+
cit:
16+
mode: shell

.github/workflows/build.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Build FreeBSD Base Core Image
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths-ignore: ['*.md', 'LICENSE', '.gitignore']
7+
pull_request:
8+
branches: [main]
9+
workflow_dispatch:
10+
11+
jobs:
12+
build:
13+
uses: daemonless/dbuild/.github/workflows/daemonless-build.yaml@main
14+
with:
15+
image_name: base-core
16+
secrets: inherit

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
scripts/build-base.sh

.woodpecker.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Woodpecker CI workflow for building FreeBSD container images with dbuild.
2+
#
3+
# Override the bootstrap step by placing .daemonless/bootstrap.sh in your repo.
4+
# Commit message directives: [skip test], [skip push], [skip sbom]
5+
6+
steps:
7+
- name: build
8+
image: /bin/sh
9+
commands:
10+
- |
11+
DBUILD_REF="${DBUILD_REF:-v2}"
12+
if [ -n "$DBUILD_PATH" ] && [ -d "$DBUILD_PATH/dbuild" ]; then
13+
export PYTHONPATH="$DBUILD_PATH"
14+
elif [ -d "../dbuild/dbuild" ]; then
15+
export PYTHONPATH="$(cd ../dbuild && pwd)"
16+
else
17+
if [ -f .daemonless/bootstrap.sh ]; then
18+
sh .daemonless/bootstrap.sh
19+
else
20+
fetch -qo /tmp/bootstrap.sh \
21+
"https://raw.githubusercontent.com/daemonless/dbuild/${DBUILD_REF}/bootstrap.sh"
22+
sh /tmp/bootstrap.sh
23+
fi
24+
export PYTHONPATH="${DBUILD_DIR:-/tmp/dbuild}"
25+
fi
26+
27+
python3 -m dbuild ci-run
28+
29+
when:
30+
- event: push
31+
branch: main
32+
path:
33+
exclude: ["*.md", "docs/**", "LICENSE", ".gitignore"]
34+
- event: manual

Containerfile

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# --------------------------------------------------------------------------
2+
# THIS FILE IS AUTOGENERATED - DO NOT EDIT MANUALLY
3+
#
4+
# Source: Containerfile.j2
5+
# --------------------------------------------------------------------------
6+
7+
ARG FREEBSD_RELEASE=15.0
8+
FROM ghcr.io/freebsd/freebsd-runtime:${FREEBSD_RELEASE}
9+
10+
ARG FREEBSD_MAJOR=15
11+
ARG PKG_BRANCH=quarterly
12+
ARG PACKAGES="FreeBSD-utilities jq ca_root_nss"
13+
ARG VERSION=""
14+
15+
LABEL org.opencontainers.image.title="FreeBSD Base Core" \
16+
org.opencontainers.image.description="Minimal FreeBSD base image without service supervision. Foundation for CLI tools and non-daemon containers." \
17+
org.opencontainers.image.source="https://github.com/daemonless/base-core" \
18+
org.opencontainers.image.url="https://github.com/daemonless/base-core" \
19+
org.opencontainers.image.licenses="" \
20+
org.opencontainers.image.vendor="daemonless" \
21+
org.opencontainers.image.authors="daemonless" \
22+
io.daemonless.type="base" \
23+
io.daemonless.category="Base" \
24+
io.daemonless.packages="${PACKAGES}"
25+
26+
ENV ASSUME_ALWAYS_YES=yes
27+
ENV PUID=1000
28+
ENV PGID=1000
29+
ENV TZ=UTC
30+
31+
COPY root/ /
32+
33+
RUN mkdir -p /etc/pkg && \
34+
printf '%s\n' \
35+
'FreeBSD-ports-kmods: { enabled: no }' \
36+
'FreeBSD-base: {' \
37+
' url: "pkg+https://pkg.FreeBSD.org/${ABI}/base_release_${VERSION_MINOR}",' \
38+
' mirror_type: "srv",' \
39+
' signature_type: "fingerprints",' \
40+
' fingerprints: "/usr/share/keys/pkgbase-${VERSION_MAJOR}",' \
41+
' enabled: yes' \
42+
'}' \
43+
'FreeBSD-Ports: {' \
44+
" url: \"pkg+https://pkg.FreeBSD.org/\${ABI}/${PKG_BRANCH}\"," \
45+
' mirror_type: "srv",' \
46+
' signature_type: "fingerprints",' \
47+
' fingerprints: "/usr/share/keys/pkg",' \
48+
' enabled: yes' \
49+
'}' > /etc/pkg/FreeBSD.conf
50+
51+
RUN rm -rf /usr/local/etc/pkg/repos && \
52+
pkg update && \
53+
pkg install -y ${PACKAGES} && \
54+
chmod 755 /usr/local/sbin && \
55+
pkg clean -ay && \
56+
rm -rf /var/cache/pkg/* /var/db/pkg/repos/*
57+
58+
RUN pw groupadd -n bsd -g 1000 && \
59+
pw useradd -n bsd -u 1000 -g bsd -d /config -s /bin/sh -c "Container User"
60+
61+
CMD ["tail", "-f", "/dev/null"]

Containerfile.j2

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
ARG FREEBSD_RELEASE=15.0
2+
FROM ghcr.io/freebsd/freebsd-runtime:${FREEBSD_RELEASE}
3+
4+
ARG FREEBSD_MAJOR=15
5+
ARG PKG_BRANCH=quarterly
6+
ARG PACKAGES="FreeBSD-utilities jq ca_root_nss"
7+
ARG VERSION=""
8+
9+
LABEL org.opencontainers.image.title="{{ title }}" \
10+
org.opencontainers.image.description="{{ description }}" \
11+
org.opencontainers.image.source="{{ repo_url }}" \
12+
org.opencontainers.image.url="{{ repo_url }}" \
13+
org.opencontainers.image.licenses="{{ license }}" \
14+
org.opencontainers.image.vendor="daemonless" \
15+
org.opencontainers.image.authors="daemonless" \
16+
io.daemonless.type="base" \
17+
io.daemonless.category="{{ category }}" \
18+
io.daemonless.packages="${PACKAGES}"
19+
20+
ENV ASSUME_ALWAYS_YES=yes
21+
ENV PUID=1000
22+
ENV PGID=1000
23+
ENV TZ=UTC
24+
25+
COPY root/ /
26+
27+
RUN mkdir -p /etc/pkg && \
28+
printf '%s\n' \
29+
'FreeBSD-ports-kmods: { enabled: no }' \
30+
'FreeBSD-base: {' \
31+
' url: "pkg+https://pkg.FreeBSD.org/${ABI}/base_release_${VERSION_MINOR}",' \
32+
' mirror_type: "srv",' \
33+
' signature_type: "fingerprints",' \
34+
' fingerprints: "/usr/share/keys/pkgbase-${VERSION_MAJOR}",' \
35+
' enabled: yes' \
36+
'}' \
37+
'FreeBSD-Ports: {' \
38+
" url: \"pkg+https://pkg.FreeBSD.org/\${ABI}/${PKG_BRANCH}\"," \
39+
' mirror_type: "srv",' \
40+
' signature_type: "fingerprints",' \
41+
' fingerprints: "/usr/share/keys/pkg",' \
42+
' enabled: yes' \
43+
'}' > /etc/pkg/FreeBSD.conf
44+
45+
RUN rm -rf /usr/local/etc/pkg/repos && \
46+
pkg update && \
47+
pkg install -y ${PACKAGES} && \
48+
chmod 755 /usr/local/sbin && \
49+
pkg clean -ay && \
50+
rm -rf /var/cache/pkg/* /var/db/pkg/repos/*
51+
52+
RUN pw groupadd -n bsd -g 1000 && \
53+
pw useradd -n bsd -u 1000 -g bsd -d /config -s /bin/sh -c "Container User"
54+
55+
CMD ["tail", "-f", "/dev/null"]

LICENSE

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
BSD 2-Clause License
2+
3+
Copyright (c) 2025, daemonless contributors
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
1. Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
2. Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<!--
2+
THIS FILE IS AUTOGENERATED - DO NOT EDIT MANUALLY
3+
Source: dbuild templates
4+
-->
5+
6+
# FreeBSD Base Core
7+
8+
[![Build Status](https://img.shields.io/github/actions/workflow/status/daemonless/base-core/build.yaml?style=flat-square&label=Build&color=green)](https://github.com/daemonless/base-core/actions)
9+
[![Last Commit](https://img.shields.io/github/last-commit/daemonless/base-core?style=flat-square&label=Last+Commit&color=blue)](https://github.com/daemonless/base-core/commits)
10+
11+
Minimal FreeBSD base image without service supervision. Foundation for CLI tools and non-daemon containers.
12+
13+
| | |
14+
|---|---|
15+
| **Registry** | `localhost/base-core` |
16+
| **Source** | [https://github.com/freebsd/freebsd-src](https://github.com/freebsd/freebsd-src) |
17+
| **Website** | [https://www.freebsd.org/](https://www.freebsd.org/) |
18+
19+
## Version Tags
20+
21+
| Tag | Description | Best For |
22+
| :--- | :--- | :--- |
23+
| `15-pkg` / `latest` | **FreeBSD Port**. Built from FreeBSD packages. | Production stability. |
24+
| `15-pkg-latest` | **FreeBSD Port**. Built from FreeBSD packages. | Production stability. |
25+
26+
## Prerequisites
27+
28+
Before deploying, ensure your host environment is ready. See the [Quick Start Guide](https://daemonless.io/guides/quick-start) for host setup instructions.
29+
30+
## Deployment
31+
32+
### Podman Compose
33+
34+
```yaml
35+
services:
36+
base-core:
37+
image: localhost/base-core:latest
38+
container_name: base-core
39+
restart: unless-stopped
40+
```
41+
42+
### Podman CLI
43+
44+
```bash
45+
podman run -d --name base-core \
46+
localhost/base-core:latest
47+
```
48+
49+
### Ansible
50+
51+
```yaml
52+
- name: Deploy base-core
53+
containers.podman.podman_container:
54+
name: base-core
55+
image: localhost/base-core:latest
56+
state: started
57+
restart_policy: always
58+
```
59+
60+
## Parameters
61+
62+
**Architectures:** amd64
63+
**User:** `bsd` (UID/GID via PUID/PGID, defaults to 1000:1000)
64+
**Base:** FreeBSD 15.0
65+

compose.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: base-core
2+
3+
x-daemonless:
4+
title: "FreeBSD Base Core"
5+
icon: ":simple-freebsd:"
6+
category: "Base"
7+
description: "Minimal FreeBSD base image without service supervision. Foundation for CLI tools and non-daemon containers."
8+
license: "BSD-2-Clause"
9+
repo_url: "https://github.com/daemonless/base-core"
10+
upstream_url: "https://github.com/freebsd/freebsd-src"
11+
web_url: "https://www.freebsd.org/"
12+
user: "bsd"
13+
upstream_binary: false
14+
15+
docs: {}
16+
17+
services: {}

root/etc/mtree/BSD.local.dist

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# mtree spec for /usr/local directory structure
2+
# Fixes permissions that pkg may set incorrectly
3+
4+
/set type=dir uname=root gname=wheel mode=0755
5+
6+
.
7+
bin
8+
..
9+
etc
10+
pkg
11+
repos
12+
..
13+
..
14+
..
15+
lib
16+
..
17+
libdata
18+
..
19+
libexec
20+
..
21+
sbin
22+
..
23+
share
24+
..
25+
..

0 commit comments

Comments
 (0)