2023-04-14 21:27:40 -07:00
|
|
|
# syntax=docker/dockerfile:latest
|
2024-09-15 18:47:22 -07:00
|
|
|
ARG BASE_IMAGE=alpine
|
2024-01-14 14:57:09 -08:00
|
|
|
ARG LINUX_DISTRO=alpine
|
|
|
|
% if [[ "$BASE_IMAGE_COPY" ]]; then
|
|
|
|
FROM <% $LINUX_DISTRO %>
|
|
|
|
COPY --from=<% $BASE_IMAGE %> / /
|
|
|
|
% else
|
|
|
|
FROM $BASE_IMAGE
|
|
|
|
% fi
|
|
|
|
|
2024-09-15 18:47:22 -07:00
|
|
|
# repeat these so they are available for rest of dockerfile
|
2023-04-14 21:27:40 -07:00
|
|
|
ARG BASE_IMAGE
|
2024-09-15 18:47:22 -07:00
|
|
|
ARG LINUX_DISTRO
|
|
|
|
#
|
2023-04-14 21:27:40 -07:00
|
|
|
ARG VERBOSE
|
2023-04-22 08:19:45 -07:00
|
|
|
ARG REBUILD
|
2023-04-14 21:27:40 -07:00
|
|
|
WORKDIR /build
|
|
|
|
|
2024-10-17 16:17:59 -07:00
|
|
|
# put /opt/bin in path permently
|
|
|
|
ENV PATH="/opt/bin:${PATH}"
|
|
|
|
|
2023-04-22 08:19:45 -07:00
|
|
|
# CORE
|
|
|
|
RUN --mount=type=bind,source=./core,target=/build \
|
2023-04-14 21:27:40 -07:00
|
|
|
<<eot
|
2023-04-22 08:19:45 -07:00
|
|
|
.INCLUDE core.tpl
|
2023-04-14 21:27:40 -07:00
|
|
|
eot
|
|
|
|
|
2023-04-22 08:19:45 -07:00
|
|
|
% if [[ ( "$_packages_" && ! $BUILD_SRC = "_core_" ) ]]; then
|
|
|
|
.INCLUDE packages.run
|
|
|
|
% fi
|
2023-04-14 21:27:40 -07:00
|
|
|
|
2024-01-14 14:57:09 -08:00
|
|
|
% if [[ ( -d "$BUILD_SRC/rootfs" && ! $BUILD_SRC = "_core_" ) ]]; then
|
|
|
|
COPY .src/rootfs/ /
|
|
|
|
% fi
|
|
|
|
|
|
|
|
% if [[ ( -f "$BUILD_SRC/init/init.sh" && ! $BUILD_SRC = "_core_" ) ]]; then
|
2023-04-22 08:19:45 -07:00
|
|
|
.INCLUDE init.run
|
|
|
|
% fi
|
2023-04-14 21:27:40 -07:00
|
|
|
|
2024-01-14 14:57:09 -08:00
|
|
|
# appends any additional custom Dockerfile code in source
|
2024-09-15 18:47:22 -07:00
|
|
|
.INCLUDE? "$BDIR/.src/Dockerfile"
|
2024-01-14 14:57:09 -08:00
|
|
|
|
|
|
|
% if [[ $VOLUME_DIRS ]]; then
|
|
|
|
VOLUME <% $VOLUME_DIRS %>
|
|
|
|
% fi
|
|
|
|
|
2023-04-14 21:27:40 -07:00
|
|
|
# default command
|
|
|
|
ENTRYPOINT ["/opt/bin/entrypoint"]
|
|
|
|
# default
|
2024-01-14 14:57:09 -08:00
|
|
|
WORKDIR <% ${WORKDIR:-/opt} %>
|
2023-04-14 21:27:40 -07:00
|
|
|
|
|
|
|
|