uci-docker-build/Dockerfile.d/Dockerfile.tpl

49 lines
930 B
Docker
Raw Normal View History

# syntax=docker/dockerfile:latest
ARG BASE_IMAGE
ARG LINUX_DISTRO=alpine
% if [[ "$BASE_IMAGE_COPY" ]]; then
FROM <% $LINUX_DISTRO %>
COPY --from=<% $BASE_IMAGE %> / /
% else
FROM $BASE_IMAGE
% fi
ARG BASE_IMAGE
ARG VERBOSE
ARG REBUILD
ARG LINUX_DISTRO=alpine
WORKDIR /build
# CORE
RUN --mount=type=bind,source=./core,target=/build \
<<eot
.INCLUDE core.tpl
eot
% if [[ ( "$_packages_" && ! $BUILD_SRC = "_core_" ) ]]; then
.INCLUDE packages.run
% fi
% if [[ ( -d "$BUILD_SRC/rootfs" && ! $BUILD_SRC = "_core_" ) ]]; then
COPY .src/rootfs/ /
% fi
% if [[ ( -f "$BUILD_SRC/init/init.sh" && ! $BUILD_SRC = "_core_" ) ]]; then
.INCLUDE init.run
% fi
# appends any additional custom Dockerfile code in source
.INCLUDE "$BDIR/.src/Dockerfile"
% if [[ $VOLUME_DIRS ]]; then
VOLUME <% $VOLUME_DIRS %>
% fi
# default command
ENTRYPOINT ["/opt/bin/entrypoint"]
# default
WORKDIR <% ${WORKDIR:-/opt} %>