Dockerfile 620 B

12345678910111213141516171819202122232425
  1. # specify node.js image
  2. FROM node:22-alpine
  3. # use production node environment by default
  4. ENV NODE_ENV=production
  5. # set working directory.
  6. WORKDIR /app
  7. # download dependencies while using Docker's caching
  8. RUN --mount=type=bind,source=package.json,target=package.json \
  9. --mount=type=bind,source=package-lock.json,target=package-lock.json \
  10. --mount=type=cache,target=/root/.npm \
  11. npm ci --omit=dev
  12. RUN mkdir -p /var/lib/kutt
  13. # copy the rest of source files into the image
  14. COPY . .
  15. # expose the port that the app listens on
  16. EXPOSE 3000
  17. # intialize database and run the app
  18. CMD npm run migrate && npm start