Skip to content

Commit cd54586

Browse files
authored
[home] Reintroduce nginx.conf.template (#628)
Allows env vars (PORT) in nginx conf
1 parent 01d3479 commit cd54586

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

services/home/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414

1515
FROM nginx:1.27.5-alpine
1616

17+
# Set the default output directory for templating
18+
ENV NGINX_ENVSUBST_OUTPUT_DIR=/etc/nginx
19+
1720
# Copy custom Nginx configuration
18-
COPY --chown=nginx:nginx nginx.conf /etc/nginx/nginx.conf
21+
COPY --chown=nginx:nginx nginx.conf /etc/nginx/templates/nginx.conf.template
1922

2023
# Copy built Docusaurus site from the buid folder
2124
COPY --chown=nginx:nginx build /usr/share/nginx/html
2225

23-
# Nginx listens on 8080, expose it (for documentation/clarity)
24-
EXPOSE 8080
25-
2626
# Start Nginx in the foreground
2727
CMD [ "nginx", "-g", "daemon off;" ]

services/home/nginx.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ http {
7272
# ========= Server Block =========
7373
server {
7474
# Listen on the port specified by Cloud Run ($PORT), default is 8080
75-
listen 8080 default_server;
76-
listen [::]:8080 default_server;
75+
listen ${PORT} default_server;
76+
listen [::]:${PORT} default_server;
7777

7878
# https://stackoverflow.com/questions/62648644/hosting-docusaurus-v2-using-nginx
7979
# prevent docusaurus to create a redirect to Cloud Run Endpoint or port 8080

0 commit comments

Comments
 (0)