Skip to content

Commit

Permalink
build: add Docker entrypoint script
Browse files Browse the repository at this point in the history
Co-authored-by: Nicolas Duchon <[email protected]>
Co-authored-by: Olliver Schinagl <[email protected]>
Co-authored-by: Richard Hansen <[email protected]>
  • Loading branch information
3 people committed Dec 9, 2023
1 parent 2c58e80 commit b1d391a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ ENV DOCKER_GEN_VERSION=${DOCKER_GEN_VERSION} \
# Install packages required by the image
RUN apk add --no-cache --virtual .bin-deps openssl

# Copy the entrypoint script
COPY /app/docker-entrypoint.sh /app/docker-entrypoint.sh

# Install docker-gen from build stage
COPY --from=go-builder /build/docker-gen /usr/local/bin/docker-gen

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

ENTRYPOINT ["/usr/local/bin/docker-gen"]
ENTRYPOINT ["/app/docker-entrypoint.sh"]
5 changes: 4 additions & 1 deletion Dockerfile.debian
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@ RUN apt-get update \
&& apt-get clean \
&& rm -r /var/lib/apt/lists/*

# Copy the entrypoint script
COPY /app/docker-entrypoint.sh /app/docker-entrypoint.sh

# Install docker-gen from build stage
COPY --from=go-builder /build/docker-gen /usr/local/bin/docker-gen

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

ENTRYPOINT ["/usr/local/bin/docker-gen"]
ENTRYPOINT ["/app/docker-entrypoint.sh"]
8 changes: 8 additions & 0 deletions app/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

set -eu

# run container's CMD if it is an executable in PATH
command -v -- "$1" >/dev/null 2>&1 || set -- docker-gen "$@"

exec "$@"

0 comments on commit b1d391a

Please sign in to comment.