frontend: add dockerfile

Signed-off-by: Nicolas Froger <nicolas@kektus.xyz>
This commit is contained in:
Nicolas Froger 2024-07-25 19:37:43 +02:00
commit 8873fdb2c8
No known key found for this signature in database
2 changed files with 37 additions and 0 deletions

View 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

View 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;
}
}