Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,31 @@ set-experimental:
@echo "> Setting experimental"
$(PACK_CMD) config experimental true

####################
## FreeBSD pack with podman
####################

build-freebsd: build-freebsd-bases build-freebsd-packages build-freebsd-builders

build-freebsd-bases: build-base-freebsd150

build-freebsd150: build-base-freebsd150 build-builder-freebsd150

build-base-freebsd150:
@echo "> Building 'freebsd150' base images..."
${PACK_CMD} config experimental true
bash base-images/build.sh -f docker.io/gogolok/freebsdcnbs-base -p freebsd/amd64 freebsd150

build-freebsd-builders: build-builder-freebsd150

build-builder-freebsd150: build-freebsd-packages build-sample-root
@echo "> Building 'freebsd150' builder..."
$(PACK_CMD) builder create docker.io/gogolok/freebsdcnbs-sample-builder:freebsd150 --config $(SAMPLES_ROOT)/builders/freebsd150/builder.toml $(PULL_POLICY_NEVER)

build-freebsd-packages: build-sample-root
@echo "> Creating 'hello-world' buildpack package"
$(PACK_CMD) buildpack package docker.io/gogolok/freebsdcnbs-sample-package:hello-world --config $(SAMPLES_ROOT)/$(PACKAGES_DIR)/hello-world/package.toml $(PULL_POLICY_NEVER) --target "freebsd/amd64"

####################
## Windows pack for any daemon OS
####################
Expand Down
4 changes: 2 additions & 2 deletions base-images/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ FROM_IMAGE=$(head -n1 "${IMAGE_DIR}"/base/Dockerfile | cut -d' ' -f2)
CONTAINER_RUNTIME=${CONTAINER_RUNTIME:-docker}

# Get target distro information
DISTRO_NAME=$(${CONTAINER_RUNTIME} run --rm "${FROM_IMAGE}" cat /etc/os-release | grep '^ID=' | cut -d'=' -f2)
DISTRO_NAME=freebsd #$(${CONTAINER_RUNTIME} run --rm "${FROM_IMAGE}" cat /etc/os-release | grep '^ID=' | cut -d'=' -f2)
echo "DISTRO_NAME: ${DISTRO_NAME}"
DISTRO_VERSION=$(${CONTAINER_RUNTIME} run --rm "${FROM_IMAGE}" cat /etc/os-release | grep '^VERSION_ID=' | cut -d'=' -f2)
DISTRO_VERSION=15.0 #(${CONTAINER_RUNTIME} run --rm "${FROM_IMAGE}" cat /etc/os-release | grep '^VERSION_ID=' | cut -d'=' -f2)
echo "DISTRO_VERSION: ${DISTRO_VERSION}"

if [[ -d "${IMAGE_DIR}/base" ]]; then
Expand Down
15 changes: 15 additions & 0 deletions base-images/freebsd150/base/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM docker.io/freebsd/freebsd-runtime:15.0

RUN pkg install -y \
ca_root_nss \
bash \
&& pkg clean -y

# HACK
RUN /etc/rc.d/os-release start

# Set required CNB target information
ARG distro_name
LABEL io.buildpacks.base.distro.name=${distro_name}
ARG distro_version
LABEL io.buildpacks.base.distro.version=${distro_version}
17 changes: 17 additions & 0 deletions base-images/freebsd150/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
ARG base_image
FROM ${base_image}

#COPY ./cnb/build-config/env/* /cnb/build-config/env/

# Create user and group
ARG cnb_uid=1001
ARG cnb_gid=1001
RUN pw groupadd cnb -g ${cnb_gid} && \
pw useradd cnb -u ${cnb_uid} -g cnb -m -s /usr/local/bin/bash

# Set user and group
USER ${cnb_uid}:${cnb_gid}

# Set required CNB information
ENV CNB_USER_ID=${cnb_uid}
ENV CNB_GROUP_ID=${cnb_gid}
11 changes: 11 additions & 0 deletions base-images/freebsd150/run/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ARG base_image
FROM ${base_image}

# Create user and group
ARG cnb_uid=1001
ARG cnb_gid=1001
RUN pw groupadd cnb -g ${cnb_gid} && \
pw useradd cnb -u ${cnb_uid} -g cnb -m -s /usr/local/bin/bash

# Set user and group
USER ${cnb_uid}:${cnb_gid}
26 changes: 26 additions & 0 deletions builders/freebsd150/builder.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Buildpacks to include in builder
[[buildpacks]]
uri = "docker.io/gogolok/freebsdcnbs-sample-package:hello-world"

[[order]]
[[order.group]]
id = "samples/hello-world"

# Base images used to create the builder
[build]
image = "docker.io/gogolok/freebsdcnbs-base-build:freebsd150"
[run]
[[run.images]]
image = "docker.io/gogolok/freebsdcnbs-base-run:freebsd150"

# WIP
[lifecycle]
uri = "./lifecycle-freebsd.amd64.tgz"

[[targets]]
arch = "amd64"
os = "freebsd"

[[targets]]
arch = "arm64"
os = "freebsd"
3 changes: 3 additions & 0 deletions buildpacks/hello-moon/buildpack.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ sbom-formats = ["application/vnd.cyclonedx+json"]
# Targets the buildpack will work with
[[targets]]
os = "linux"

[[targets]]
os = "freebsd"
3 changes: 3 additions & 0 deletions buildpacks/hello-world/buildpack.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ homepage = "https://github.com/buildpacks/samples/tree/main/buildpacks/hello-wor
# Targets the buildpack will work with
[[targets]]
os = "linux"

[[targets]]
os = "freebsd"