improve: add production stage
This commit is contained in:
22
Dockerfile
22
Dockerfile
@@ -1,15 +1,27 @@
|
||||
FROM node:18 as build-stage
|
||||
FROM node:18-alpine AS build-stage
|
||||
WORKDIR /app
|
||||
|
||||
|
||||
COPY package*.json ./
|
||||
|
||||
RUN npm install
|
||||
|
||||
COPY . .
|
||||
COPY BuildConfig.sh /app/BuildConfig.sh
|
||||
RUN chmod +x /app/BuildConfig.sh
|
||||
RUN npm run build
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["/bin/bash", "-c", "/app/BuildConfig.sh && npm start"]
|
||||
FROM nginx:stable-alpine AS production-stage
|
||||
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
WORKDIR /app
|
||||
COPY package*.json ./
|
||||
|
||||
COPY --from=build-stage /app/dist /usr/share/nginx/html
|
||||
COPY --from=build-stage /app/public/icons /usr/share/nginx/html/icons
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY BuildConfig.sh /docker-entrypoint.d/10-build-config.sh
|
||||
RUN chmod a+x /docker-entrypoint.d/10-build-config.sh
|
||||
EXPOSE $FRONTEND_PORT
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
|
||||
Reference in New Issue
Block a user