Skip to content

Commit e685699

Browse files
committed
static-envsubst
1 parent e7d31d3 commit e685699

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

static-envsubst.scratch.Dockerfile

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# build: docker build --no-cache --progress=plain --target binary --build-arg ENVSUBST_VERSION=1.4.3 -t tobi312/tools:static-envsubst -f static-envsubst.scratch.Dockerfile .
2+
ARG ENVSUBST_VERSION
3+
FROM alpine:latest AS static-envsubst
4+
5+
ARG ENVSUBST_VERSION
6+
7+
# envsubst https://github.com/a8m/envsubst
8+
9+
SHELL ["/bin/ash", "-euxo", "pipefail", "-c"]
10+
11+
RUN \
12+
ARCH=$(uname -m) ; \
13+
echo ">> ARCH=$ARCH" ; \
14+
case "$ARCH" in \
15+
x86_64) TARGETARCH="x86_64" ;; \
16+
aarch64) TARGETARCH="arm64" ;; \
17+
*) echo ">> Unknown architecture: $ARCH" && exit 1 ;; \
18+
esac ; \
19+
echo ">> Mapped architecture: $TARGETARCH" ; \
20+
\
21+
ENVSUBST_VERSION=${ENVSUBST_VERSION:-$(wget -qO- https://api.github.com/repos/a8m/envsubst/releases/latest | grep 'tag_name' | cut -d\" -f4)} ; \
22+
ENVSUBST_VERSION=$(echo ${ENVSUBST_VERSION} | sed 's/^v//') ; \
23+
echo ">> ENVSUBST_VERSION=${ENVSUBST_VERSION}" ; \
24+
wget -q "https://github.com/a8m/envsubst/releases/download/v${ENVSUBST_VERSION}/envsubst-Linux-${TARGETARCH}" -O /usr/local/bin/envsubst ; \
25+
chmod +x /usr/local/bin/envsubst ; \
26+
echo ">> envsubst Help:" ; \
27+
envsubst -help
28+
29+
30+
FROM scratch AS binary
31+
32+
ARG ENVSUBST_VERSION
33+
ARG VCS_REF
34+
ARG BUILD_DATE
35+
36+
LABEL org.opencontainers.image.title="envsubst" \
37+
org.opencontainers.image.authors="a8m, Tobias Hargesheimer <docker@ison.ws>" \
38+
org.opencontainers.image.version="${ENVSUBST_VERSION}" \
39+
org.opencontainers.image.created="${BUILD_DATE}" \
40+
org.opencontainers.image.revision="${VCS_REF}" \
41+
org.opencontainers.image.description="Static envsubst - environment variables substitution for Go" \
42+
org.opencontainers.image.documentation="https://github.com/a8m/envsubst" \
43+
org.opencontainers.image.licenses="MIT" \
44+
org.opencontainers.image.base.name="scratch" \
45+
org.opencontainers.image.url="https://github.com/Tob1as/docker-tools" \
46+
org.opencontainers.image.source="https://github.com/a8m/envsubst"
47+
48+
COPY --from=static-envsubst /usr/local/bin/envsubst /usr/local/bin/envsubst
49+
50+
ENTRYPOINT ["envsubst"]
51+
#CMD ["-help"]

0 commit comments

Comments
 (0)