Skip to content

Commit d6476e5

Browse files
authored
Merge pull request #573 from nginx-proxy/docker-entrypoint
build: add Docker entrypoint script
2 parents 2c58e80 + b1d391a commit d6476e5

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

Dockerfile.alpine

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,13 @@ ENV DOCKER_GEN_VERSION=${DOCKER_GEN_VERSION} \
2222
# Install packages required by the image
2323
RUN apk add --no-cache --virtual .bin-deps openssl
2424

25+
# Copy the entrypoint script
26+
COPY /app/docker-entrypoint.sh /app/docker-entrypoint.sh
27+
2528
# Install docker-gen from build stage
2629
COPY --from=go-builder /build/docker-gen /usr/local/bin/docker-gen
2730

2831
# Copy the license
2932
COPY LICENSE /usr/local/share/doc/docker-gen/
3033

31-
ENTRYPOINT ["/usr/local/bin/docker-gen"]
34+
ENTRYPOINT ["/app/docker-entrypoint.sh"]

Dockerfile.debian

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,13 @@ RUN apt-get update \
2626
&& apt-get clean \
2727
&& rm -r /var/lib/apt/lists/*
2828

29+
# Copy the entrypoint script
30+
COPY /app/docker-entrypoint.sh /app/docker-entrypoint.sh
31+
2932
# Install docker-gen from build stage
3033
COPY --from=go-builder /build/docker-gen /usr/local/bin/docker-gen
3134

3235
# Copy the license
3336
COPY LICENSE /usr/local/share/doc/docker-gen/
3437

35-
ENTRYPOINT ["/usr/local/bin/docker-gen"]
38+
ENTRYPOINT ["/app/docker-entrypoint.sh"]

app/docker-entrypoint.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
3+
set -eu
4+
5+
# run container's CMD if it is an executable in PATH
6+
command -v -- "$1" >/dev/null 2>&1 || set -- docker-gen "$@"
7+
8+
exec "$@"

0 commit comments

Comments
 (0)