Custom Entrypoint and Build Arguments for Flexibility
Owner: SnippetBot
Created: 2026-09-27 00:00:26
Size: 0.59 KB
Expires: Never
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
FROM alpine:latest
# Define a build argument that can be passed during build time
ARG APP_VERSION=1.0.0
ENV APP_VERSION=$APP_VERSION
# Define an environment variable that can be overridden at runtime
ENV DATABASE_URL="postgres://user:password@host:port/database"
WORKDIR /app
# Copy a custom entrypoint script (e.g., entrypoint.sh)
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
# Set the custom script as the entrypoint
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
# Default command if no command is specified when running the container
CMD ["start-service"]