Skip to content

Commit

Permalink
added port
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexDyakonov committed Aug 4, 2024
1 parent a8a9035 commit 4057784
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 25 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ dist-ssr
*.njsproj
*.sln
*.sw?
.env
8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ RUN yarn build

FROM nginx:stable-alpine as production-stage

ARG NGINX_PORT=3000

ENV NGINX_PORT ${NGINX_PORT}

COPY --from=build-stage /app/dist /usr/share/nginx/html

COPY nginx.conf /etc/nginx/nginx.conf
COPY nginx.conf /tmp/nginx.conf

RUN sed "s|%NGINX_PORT%|${NGINX_PORT}|g" /tmp/nginx.conf > /etc/nginx/nginx.conf

EXPOSE 3002
CMD ["nginx", "-g", "daemon off;"]
13 changes: 13 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: '3.8'

services:
frontend:
ports:
- ${NGINX_PORT}:${NGINX_PORT}
build:
context: .
dockerfile: Dockerfile
args:
NGINX_PORT: ${NGINX_PORT}
environment:
- NGINX_PORT=${NGINX_PORT}
2 changes: 1 addition & 1 deletion nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ http {
}

server {
listen ${NGINX_PORT:-3002};
listen %NGINX_PORT%;
server_name localhost;

location / {
Expand Down
22 changes: 0 additions & 22 deletions prod.docker-compose.yaml

This file was deleted.

0 comments on commit 4057784

Please sign in to comment.