drawDB/Dockerfile

14 lines
469 B
Docker
Raw Normal View History

2024-04-14 15:20:14 +08:00
# Stage 1: Build the app
2024-09-11 02:32:35 +08:00
FROM node:20-alpine AS build
2024-04-07 23:26:48 +08:00
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
2024-04-14 15:20:14 +08:00
# Stage 2: Setup the Nginx Server to serve the app
2024-09-11 02:32:35 +08:00
FROM nginx:stable-alpine3.17 AS production
2024-04-07 23:26:48 +08:00
COPY --from=build /app/dist /usr/share/nginx/html
2024-04-10 13:51:04 +08:00
RUN echo 'server { listen 80; server_name _; root /usr/share/nginx/html; location / { try_files $uri /index.html; } }' > /etc/nginx/conf.d/default.conf
2024-04-07 23:26:48 +08:00
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]