Production ready

This commit is contained in:
Florian Sylvain
2023-03-09 12:24:50 +01:00
parent e06bd7fbcb
commit 2bb42e6aa1
8 changed files with 61 additions and 2 deletions
View File
+12
View File
@@ -0,0 +1,12 @@
FROM node:latest as build-stage
WORKDIR /app
COPY ./web/package*.json ./
COPY ./.env ./
RUN npm ci
COPY ./web/ .
RUN npm run build
FROM nginx as production-stage
RUN mkdir /app
COPY --from=build-stage /app/dist /app
COPY ./web/nginx.conf /etc/nginx/nginx.conf
+2
View File
@@ -12,6 +12,8 @@
### For website ### For website
- API_ADDRESS - API_ADDRESS
- FRONT_PORT
- FRONT_BASE_PATH
## Usage ## Usage
+15 -1
View File
@@ -16,7 +16,9 @@ services:
timeout: 30s timeout: 30s
retries: 10 retries: 10
backend: backend:
build: . build:
context: ./
dockerfile: ./Dockerfile.backend
image: parismuseesquizz-backend image: parismuseesquizz-backend
depends_on: depends_on:
db: db:
@@ -29,6 +31,18 @@ services:
- back-net - back-net
ports: ports:
- "${API_PORT}:${API_PORT}" - "${API_PORT}:${API_PORT}"
frontend:
build:
context: ./
dockerfile: ./Dockerfile.frontend
image: parismuseesquizz-frontend
env_file:
- .env
ports:
- "${FRONT_PORT}:80"
networks:
- front-net
networks: networks:
back-net: back-net:
front-net:
+1 -1
View File
@@ -4,7 +4,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<link rel="icon" href="/favicon.ico"> <link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vite App</title> <title>Quizz Paris Musées</title>
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>
+30
View File
@@ -0,0 +1,30 @@
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root /app;
index index.html;
try_files $uri $uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}
View File
+1
View File
@@ -21,5 +21,6 @@ export default defineConfig(({ command, mode }): UserConfig => {
...env2, ...env2,
}, },
}, },
base: env1.FRONT_BASE_PATH ?? env2.FRONT_BASE_PATH ?? "/",
} }
}) })