Optimise Dokcerfile to only ship transpiled JS

This commit is contained in:
Maciej Pędzich 2024-07-22 09:00:10 +02:00
parent 65393d8c2f
commit 979d77cca5
Signed by: maciejpedzich
GPG Key ID: CE4A303D84882F0D

View File

@ -1,7 +1,11 @@
FROM node:lts-alpine FROM node:lts-alpine AS build
WORKDIR /app WORKDIR /app
COPY . . COPY . .
RUN npm i RUN npm i
RUN npm run build RUN npm run build
CMD ["node", "./dist/index.js"]
FROM node:lts-alpine AS runtime
WORKDIR /app
COPY --from=build /app/dist /app
CMD ["node", "./index.js"]
EXPOSE 3000 EXPOSE 3000