generated from bfren/docker-alpine-s6
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.esh
77 lines (63 loc) · 2.92 KB
/
Dockerfile.esh
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#======================================================================================================================
# STAGE 0: download S6 overlay
#======================================================================================================================
FROM --platform=${BUILDPLATFORM} golang:alpine AS s6
ARG TARGETPLATFORM
WORKDIR /s6
RUN \
# build a URL to download S6 binaries
echo "Downloading S6 Overlay." && \
case "${TARGETPLATFORM}" in \
linux/amd64) ARCH="x86_64" ;; \
linux/arm/v7) ARCH="armhf" ;; \
linux/arm64) ARCH="aarch64" ;; \
*) echo "Unsupported target platform: ${TARGETPLATFORM}." && exit 1 ;; \
esac && \
printf "%s" "${ARCH}" > ARCH && \
URL=https://github.com/just-containers/s6-overlay/releases/download/v<%= ${S6_VERSION} %>/s6-overlay && \
wget ${URL}-${ARCH}.tar.xz && \
wget ${URL}-${ARCH}.tar.xz.sha256 && \
wget ${URL}-noarch.tar.xz && \
wget ${URL}-noarch.tar.xz.sha256
#======================================================================================================================
# STAGE 1: get overlay from Alpine S6 image
#======================================================================================================================
FROM ghcr.io/bfren/alpine AS alpine
WORKDIR /tmp
RUN \
# get the overlay from the Alpine S6 base image
echo "Cloning Alpine S6 overlay." && \
apk add git && git clone --branch <%= ${ALPINE_BRANCH} %> https://github.com/bfren/docker-alpine-s6.git && \
mv docker-alpine-s6/overlay /
#======================================================================================================================
# STAGE 2: create final image
#======================================================================================================================
FROM ghcr.io/bfren/debian:<%= ${DEBIAN_NAME} %>-<%= ${BASE_VERSION} %>
COPY --from=s6 /s6 /s6
COPY --from=alpine /overlay /
LABEL org.opencontainers.image.description="Debian base image with S6 Overlay."
LABEL org.opencontainers.image.source="https://github.com/bfren/docker-debian-s6"
ARG BF_IMAGE
ARG BF_PUBLISHING
ARG BF_VERSION
ENV \
# cron log levels are from 0 (most verbose) to 8 (default)
BF_CRON_LOG_LEVEL=8 \
# set to 0 to disable setting permissions using ch.d during init phase
BF_ENABLE_INIT_CH=1 \
# add S6 executables to PATH
PATH=/command:${PATH} \
# what the container do if one of the service scripts fails -
# 0: continue silently (default)
# 1: continue with warning
# 2: stop the container
S6_BEHAVIOUR_IF_STAGE2_FAILS=2 \
# location of S6 service directories
S6_SERVICES_DIR=/run/s6-rc/servicedirs
RUN \
# add S6 Overlay to the build log
bf-build-add "S6 Overlay" "<%= ${S6_VERSION} %>" && \
# run standard bf installation executable
bf-install
HEALTHCHECK --interval=1m --timeout=10s --start-period=5s --retries=5 \
CMD healthcheck