Skip to content

Commit 9e464f3

Browse files
committed
Refactor Dockerfile to set environment variables for upstream server, cache size, and DNS resolver
1 parent 8f20760 commit 9e464f3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ FROM nginx:1.26-alpine
33
LABEL maintainer="VirtualFlyBrain"
44
LABEL description="NGINX caching proxy for Owlery"
55

6+
ENV UPSTREAM_SERVER=owl.virtualflybrain.org:80
7+
ENV CACHE_MAX_SIZE=20g
8+
ENV DNS_RESOLVER="8.8.8.8 1.1.1.1"
9+
610
ARG NGINX_CONF=nginx.conf.template
711
COPY $NGINX_CONF /etc/nginx/nginx.conf.template
812
COPY health-monitor.sh /usr/local/bin/health-monitor.sh
@@ -12,4 +16,4 @@ RUN mkdir -p /var/cache/nginx && chown -R nginx:nginx /var/cache/nginx && \
1216

1317
EXPOSE 80
1418

15-
CMD ["/bin/sh", "-c", "UPSTREAM_SERVER=${UPSTREAM_SERVER:-owl.virtualflybrain.org:80} CACHE_MAX_SIZE=${CACHE_MAX_SIZE:-20g} DNS_RESOLVER=${DNS_RESOLVER:-8.8.8.8 1.1.1.1} envsubst '${UPSTREAM_SERVER} ${CACHE_MAX_SIZE} ${DNS_RESOLVER}' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/local/bin/health-monitor.sh & nginx -g 'daemon off;'"]
19+
CMD ["/bin/sh", "-c", "envsubst '${UPSTREAM_SERVER} ${CACHE_MAX_SIZE} ${DNS_RESOLVER}' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/local/bin/health-monitor.sh & nginx -g 'daemon off;'"]

0 commit comments

Comments
 (0)