-
Notifications
You must be signed in to change notification settings - Fork 782
/
Dockerfile
44 lines (36 loc) · 1.21 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
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0
# ===================================
#
# Release image
#
# ===================================
FROM alpine:latest AS release-default
ARG BIN_NAME=consul-template
# Export BIN_NAME for the CMD below, it can't see ARGs directly.
ENV BIN_NAME=$BIN_NAME
ARG PRODUCT_VERSION
ARG PRODUCT_REVISION
ARG PRODUCT_NAME=$BIN_NAME
# TARGETARCH and TARGETOS are set automatically when --platform is provided.
ARG TARGETOS TARGETARCH
ENV PRODUCT_NAME=$BIN_NAME
LABEL maintainer="Consul Team <[email protected]>"
# version label is required for build process
LABEL version=$PRODUCT_VERSION
LABEL revision=$PRODUCT_REVISION
LABEL licenses="MPL-2.0"
# These are the defaults, this makes them explicit and overridable.
ARG UID=100
ARG GID=1000
# Create a non-root user to run the software.
RUN addgroup -g ${GID} ${BIN_NAME} \
&& adduser -u ${UID} -S -G ${BIN_NAME} ${BIN_NAME}
# where the build system stores the builds
COPY ./dist/$TARGETOS/$TARGETARCH/$BIN_NAME /bin/
COPY LICENSE /usr/share/doc/$PRODUCT_NAME/LICENSE.txt
# entrypoint
COPY ./.release/docker-entrypoint.sh /bin/
ENTRYPOINT ["/bin/docker-entrypoint.sh"]
USER ${BIN_NAME}:${BIN_NAME}
CMD /bin/$BIN_NAME