kutt/Dockerfile

25 lines
621 B
Docker
Raw Permalink Normal View History

2025-01-09 11:38:28 +03:30
# specify node.js image
FROM node:22-alpine
2025-01-09 11:18:53 +03:30
2025-01-08 09:47:03 +03:30
# use production node environment by default
ENV NODE_ENV=production
2025-01-08 09:47:03 +03:30
# set working directory.
WORKDIR /kutt
2025-01-08 09:47:03 +03:30
# download dependencies while using Docker's caching
RUN --mount=type=bind,source=package.json,target=package.json \
--mount=type=bind,source=package-lock.json,target=package-lock.json \
--mount=type=cache,target=/root/.npm \
npm ci --omit=dev
2025-01-08 09:47:03 +03:30
RUN mkdir -p /var/lib/kutt
2025-01-08 09:47:03 +03:30
# copy the rest of source files into the image
COPY . .
2025-01-08 09:47:03 +03:30
# expose the port that the app listens on
2019-10-22 17:56:55 +03:30
EXPOSE 3000
2025-01-08 09:47:03 +03:30
# intialize database and run the app
CMD npm run migrate && npm start