Skip to content

Commit 749c68a

Browse files
committed
fix: Update Docker entrypoint script to set default PORT and modify nginx configuration
1 parent 21e1370 commit 749c68a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

frontend/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ COPY nginx.conf /etc/nginx/conf.d/default.conf.template
2424

2525
# Create script to substitute environment variables in nginx config
2626
RUN echo '#!/bin/sh' > /docker-entrypoint.sh && \
27-
echo 'envsubst < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf' >> /docker-entrypoint.sh && \
27+
echo '# Set PORT default if not provided' >> /docker-entrypoint.sh && \
28+
echo 'export PORT=${PORT:-4000}' >> /docker-entrypoint.sh && \
29+
echo 'envsubst "\$PORT" < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf' >> /docker-entrypoint.sh && \
2830
echo 'exec nginx -g "daemon off;"' >> /docker-entrypoint.sh && \
2931
chmod +x /docker-entrypoint.sh
3032

frontend/nginx.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
server {
2-
listen ${PORT:-4000};
2+
listen $PORT;
33
server_name localhost;
44

55
location / {

0 commit comments

Comments
 (0)