build: modify dockerfile to serve demo instance as static webpage
This commit is contained in:
39
Dockerfile
39
Dockerfile
@ -1,20 +1,37 @@
|
||||
FROM node:lts-alpine
|
||||
FROM node:lts-alpine AS builder
|
||||
|
||||
RUN apk add --no-cache --update git
|
||||
|
||||
WORKDIR /app
|
||||
COPY package*.json ./
|
||||
RUN npm ci
|
||||
|
||||
WORKDIR /app/server
|
||||
COPY server/package*.json ./
|
||||
RUN npm ci
|
||||
COPY server/prisma/schema.prisma ./prisma/schema.prisma
|
||||
RUN npx prisma generate
|
||||
|
||||
WORKDIR /app
|
||||
COPY ./ ./
|
||||
RUN npm run build
|
||||
|
||||
WORKDIR /app/server
|
||||
CMD ["node", "index.js"]
|
||||
FROM nginx
|
||||
COPY <<EOF /etc/nginx/conf.d/default.conf
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name localhost;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index non-existent-to-prevent-caching.html;
|
||||
try_files \$uri @index;
|
||||
}
|
||||
|
||||
location @index {
|
||||
root /usr/share/nginx/html;
|
||||
add_header Cache-Control no-cache;
|
||||
expires 0;
|
||||
try_files /index.html =404;
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
Reference in New Issue
Block a user