diff --git a/Dockerfile b/Dockerfile index f8288a1f..c307653a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,6 +34,8 @@ CMD ["bash", "-c", "./start.sh"] # Stage-2 Production Environment FROM nginx:1.19-alpine +ENV PORT=${PORT:-4000} + # Add bash RUN apk add --no-cache bash @@ -44,10 +46,10 @@ RUN chmod +x start-prod.sh COPY --from=build /app/dist/ /usr/share/nginx/html/ # Copy nginx configuration -ADD ngnix /etc/nginx/conf.d/ +ADD ngnix /etc/nginx/templates/ -# Make port 4000 available to the world outside the container -EXPOSE 4000 +# Make port available to the world outside the container +EXPOSE ${PORT} # Start the server CMD ["bash", "-c", "/start-prod.sh"] diff --git a/docker-compose.override.yml b/docker-compose.override.yml index a1d0118a..6a58a3d3 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -15,5 +15,3 @@ services: restart: on-failure volumes: - .:/app:z - environment: - - PORT=${PORT-4000} diff --git a/docker-compose.yml b/docker-compose.yml index 411e6f0c..7c8909be 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,3 +13,4 @@ services: environment: - API_URL=${API_URL-http://127.0.0.1:8000} - NODE_ENV=${NODE_ENV-development} + - PORT=4000 diff --git a/ngnix/default.conf b/ngnix/default.conf.template similarity index 87% rename from ngnix/default.conf rename to ngnix/default.conf.template index cfd3462f..194c6dd4 100644 --- a/ngnix/default.conf +++ b/ngnix/default.conf.template @@ -1,5 +1,5 @@ server { - listen 4000; + listen ${PORT}; server_name localhost; location / { root /usr/share/nginx/html;