27 lines
930 B
Docker
27 lines
930 B
Docker
# Use the official NGINX image as a parent image
|
|
FROM nginx:alpine
|
|
|
|
# Set environment variables with default values
|
|
ENV BACKEND_HOST=git_git
|
|
ENV BACKEND_TCP_PORT=22
|
|
ENV BACKEND_UDP_PORT=22
|
|
# Set the default value of ALLOWED_IPS to cover typical Docker network ranges
|
|
# set this value to 0.0.0.0 in the Stack definition for allow all.
|
|
ENV ALLOWED_IPS="10.0.0.0/8 172.16.0.0/12 192.168.0.0/16"
|
|
|
|
# Copy the script and configuration template into the container
|
|
COPY entrypoint.sh /entrypoint.sh
|
|
COPY nginx.conf.template /etc/nginx/nginx.conf.template
|
|
|
|
# Make the script executable
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
# HEALTHCHECK instruction using curl to check the health of the NGINX server
|
|
# Install curl, then set up the health check
|
|
RUN apk add --no-cache curl
|
|
HEALTHCHECK --interval=30s --timeout=3s --retries=3 \
|
|
CMD curl -f http://localhost:8080/healthz || exit 1
|
|
|
|
# Use the script as the entrypoint
|
|
ENTRYPOINT ["/entrypoint.sh"]
|