-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathDockerfile
137 lines (107 loc) · 3.91 KB
/
Dockerfile
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
ARG ALPINE_VER=3.9
ARG DEBIAN_VER=9
ARG REGISTRY=docker.io
ARG REPOSITORY=sudobmitch/base
ARG RELEASE_IMAGE=debian-base
# Alpine base image version
FROM ${REGISTRY}/library/alpine:${ALPINE_VER} as alpine-base
# Include apk-install
COPY bin.alpine/ /usr/bin/
RUN apk-install \
ca-certificates \
curl \
rsync \
shadow
# Install wait-for-it.sh
RUN curl -sSL https://github.com/vishnubob/wait-for-it/raw/master/wait-for-it.sh >/usr/bin/wait-for-it.sh \
&& chmod 755 /usr/bin/wait-for-it.sh
# Install tini
RUN apk-install \
tini
# Install gosu
ARG GOSU_VER=1.10
ARG GOSU_ARCH=amd64
RUN curl -sSL "https://github.com/tianon/gosu/releases/download/${GOSU_VER}/gosu-${GOSU_ARCH}" >/usr/bin/gosu \
&& chmod 755 /usr/bin/gosu \
&& gosu nobody true
# Include various scripts (entrypointd.sh, healthcheckd.sh, fix-perms)
COPY bin/ /usr/bin/
COPY healthcheck.d/ /etc/healthcheck.d/
HEALTHCHECK CMD /usr/bin/healthcheckd.sh
COPY entrypoint.d/ /etc/entrypoint.d/
ENTRYPOINT ["/usr/bin/entrypointd.sh"]
CMD ["/bin/sh"]
ARG IMAGE_VER=1.0.0
ARG REGISTRY=docker.io
ARG REPOSITORY=sudobmitch/base
LABEL \
org.label-schema.docker.cmd="docker run -it --rm ${REGISTRY}/${REPOSITORY}:alpine" \
org.label-schema.description="Base image for alpine" \
org.label-schema.name="${REGISTRY}/${REPOSITORY}:alpine" \
org.label-schema.schema-version="1.0" \
org.label-schema.url="https://github.com/sudo-bmitch/docker-base" \
org.label-schema.vendor="Brandon Mitchell" \
org.label-schema.version="${IMAGE_VER}"
# Debian base image version
FROM ${REGISTRY}/library/debian:${DEBIAN_VER} as debian-base
# Include apt-install
COPY bin.debian/ /usr/bin/
RUN apt-install \
ca-certificates \
curl \
rsync
# Install wait-for-it.sh
RUN curl -sSL https://github.com/vishnubob/wait-for-it/raw/master/wait-for-it.sh >/usr/bin/wait-for-it.sh \
&& chmod 755 /usr/bin/wait-for-it.sh
# Install tini
ARG TINI_VERSION=v0.16.1
RUN curl -sSL https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini >/usr/bin/tini \
&& chmod 755 /usr/bin/tini
# Install gosu
ARG GOSU_VERSION=1.10
RUN dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" \
&& curl -sSL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-${dpkgArch}" >/usr/bin/gosu \
&& chmod 755 /usr/bin/gosu \
&& gosu nobody true
# Include various scripts (entrypointd.sh, healthcheckd.sh, fix-perms)
COPY bin/ /usr/bin/
COPY healthcheck.d/ /etc/healthcheck.d/
COPY entrypoint.d/ /etc/entrypoint.d/
HEALTHCHECK CMD /usr/bin/healthcheckd.sh
ENTRYPOINT ["/usr/bin/entrypointd.sh"]
CMD ["/bin/bash"]
ARG IMAGE_VERSION=1.0.0
ARG REGISTRY=docker.io
ARG REPOSITORY=sudobmitch/base
LABEL \
org.label-schema.docker.cmd="docker run -it --rm ${REGISTRY}/${REPOSITORY}:debian" \
org.label-schema.description="Base image for debian" \
org.label-schema.name="${REGISTRY}/${REPOSITORY}:debian" \
org.label-schema.schema-version="1.0" \
org.label-schema.url="https://github.com/sudo-bmitch/docker-base" \
org.label-schema.vendor="Brandon Mitchell" \
org.label-schema.version="${IMAGE_VER}"
# Scratch base image version
FROM scratch as scratch-base
# include downloaded utilities
COPY --from=debian-base \
/usr/bin/wait-for-it.sh \
/usr/bin/tini \
/usr/bin/gosu \
/usr/bin/
# Include scripts and utilities
COPY bin/ /usr/bin/
COPY healthcheck.d/ /etc/healthcheck.d/
COPY entrypoint.d/ /etc/entrypoint.d/
ARG IMAGE_VERSION=1.0.0
ARG REGISTRY=docker.io
ARG REPOSITORY=sudobmitch/base
LABEL \
org.label-schema.description="Base image for scratch" \
org.label-schema.name="${REGISTRY}/${REPOSITORY}:scratch" \
org.label-schema.schema-version="1.0" \
org.label-schema.url="https://github.com/sudo-bmitch/docker-base" \
org.label-schema.vendor="Brandon Mitchell" \
org.label-schema.version="${IMAGE_VER}"
# build a specific image when target is not specified
FROM ${RELEASE_IMAGE} as release