Repository navigation
Expand file tree
/
Copy pathContainerfile
More file actions
48 lines (43 loc) · 1.8 KB
/
Copy pathContainerfile
File metadata and controls
48 lines (43 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Unified Containerfile for the blueprint images:
# arch, debian, ubuntu, opensuse, gentoo, nixos
#
# Select the target and base with build args (the Justfile `build` recipe does
# this for you):
# --build-arg VARIANT=<name> system_files dir + default script stem
# --build-arg BASE_IMAGE=<image> FROM for the builder + system stages
# --build-arg BUILDER_SCRIPT=<path> script run in the builder stage
# --build-arg BUILD_SCRIPT=<path> script run in the system stage
# --build-arg LINT=<0|1> run `bootc container lint` (default 1)
# Plus the shared args the build passes: IMAGE_NAME, IMAGE_VENDOR,
# MAJOR_VERSION, ENABLE_DX, GNOME_VERSION, SHA_HEAD_SHORT.
ARG VARIANT="arch"
ARG BASE_IMAGE="archlinux:latest@sha256:63c7b061c0c001cb7ce4f8d11b63d351c23e7f97121bc5c8bd5d9f431e615d7d"
ARG BUILDER_SCRIPT="builder-${VARIANT}.sh"
ARG BUILD_SCRIPT="build-${VARIANT}.sh"
ARG LINT="1"
ARG IMAGE_NAME="blueprint"
ARG IMAGE_VENDOR="huntedraven7"
ARG MAJOR_VERSION="10"
ARG ENABLE_DX="0"
ARG GNOME_VERSION="50"
ARG SHA_HEAD_SHORT="deadbeef"
FROM scratch AS ctx
# Re-declare args used after FROM (pre-FROM ARGs are out of scope in build steps).
ARG VARIANT
COPY build_files /
COPY system_files/global /system_files/global
COPY system_files/${VARIANT} /system_files/${VARIANT}
# Builder stage: compile bootc (and friends) from source for the distro.
FROM ${BASE_IMAGE} AS builder
ARG BUILDER_SCRIPT
RUN --mount=type=bind,from=ctx,source=/,target=/ctx \
/ctx/base/${BUILDER_SCRIPT}
# System stage: install the actual system packages / finalize the image.
FROM ${BASE_IMAGE} AS system
ARG BUILD_SCRIPT
ARG LINT
COPY --from=builder /output /
RUN --mount=type=bind,from=ctx,source=/,target=/ctx \
/ctx/base/${BUILD_SCRIPT}
LABEL containers.bootc 1
RUN if [ "${LINT}" != "0" ]; then bootc container lint; fi