frontend: add dockerfile
Signed-off-by: Nicolas Froger <nicolas@kektus.xyz>
This commit is contained in:
parent
e636eb65c9
commit
8873fdb2c8
2 changed files with 37 additions and 0 deletions
27
summer2024-frontend/Dockerfile
Normal file
27
summer2024-frontend/Dockerfile
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
FROM node:22-alpine3.19 as builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json ./
|
||||
|
||||
RUN npm i
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN npm run build
|
||||
|
||||
# Stage 2, based on Nginx, to have only the compiled app, ready for production with Nginx
|
||||
|
||||
FROM nginxinc/nginx-unprivileged:1.27-alpine
|
||||
|
||||
COPY ./nginx-custom.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
USER root
|
||||
|
||||
## Remove default nginx website
|
||||
RUN rm -rf /usr/share/nginx/html/*
|
||||
|
||||
## From ‘builder’ stage copy over the artifacts in dist folder to default nginx public folder
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||
|
||||
USER $UID
|
||||
10
summer2024-frontend/nginx-custom.conf
Normal file
10
summer2024-frontend/nginx-custom.conf
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
server {
|
||||
listen 8080;
|
||||
server_name localhost;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
try_files $uri $uri/ /index.html =404;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue