Skip to content

build: add Docker entrypoint script #573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 "$@"