node-api-template/Dockerfile.production

39 lines
824 B
Docker
Raw Normal View History

2024-07-05 19:34:48 +00:00
FROM node:18.20.2-buster as build
2024-07-03 18:52:30 +00:00
2024-07-05 19:34:48 +00:00
WORKDIR /src
2024-07-03 18:52:30 +00:00
2024-07-05 19:34:48 +00:00
COPY package*.json .
2024-07-03 18:52:30 +00:00
RUN npm install --silent
2024-07-05 19:34:48 +00:00
COPY . .
2024-07-03 18:52:30 +00:00
RUN npm run build
2024-07-05 19:34:48 +00:00
FROM node:18.20.2-buster as production
WORKDIR /app
ENV PATH /app/bin:$PATH
COPY --from=build /src/dist /app/dist
COPY --from=build /src/package*.json /app/
COPY --from=build /src/bin /app/bin
COPY --from=build /src/configs /app/configs
COPY --from=build /src/db /app/db
COPY --from=build /src/private /app/private
COPY --from=build /src/public /app//public
COPY --from=build /src/scripts /app/scripts
COPY --from=build /src/.sequelizerc /app/.sequelizerc
COPY --from=build /src/.env.production /app/.env.production
RUN rm -rf /app/dist/__test__
RUN npm ci --omit=dev
2024-07-03 18:52:30 +00:00
EXPOSE 3000
2024-07-05 19:34:48 +00:00
RUN chmod +x /app/bin/start_server.sh
RUN chmod +x /app/bin/www
2024-07-03 18:52:30 +00:00
2024-07-05 19:34:48 +00:00
CMD ["start_server.sh", "--env", "production"]