2024-02-28 06:41:26 +00:00
|
|
|
# syntax=docker/dockerfile:1
|
|
|
|
|
2024-05-18 03:40:45 +00:00
|
|
|
# base
|
|
|
|
FROM node:20.13.1-alpine as base
|
2024-02-28 06:41:26 +00:00
|
|
|
|
2024-05-18 03:40:45 +00:00
|
|
|
WORKDIR /app
|
2024-02-28 06:41:26 +00:00
|
|
|
|
2024-05-18 03:40:45 +00:00
|
|
|
# build
|
|
|
|
FROM base as build
|
2024-02-28 06:41:26 +00:00
|
|
|
|
2024-05-18 03:40:45 +00:00
|
|
|
RUN --mount=type=cache,target=/root/.npm \
|
|
|
|
npm install -g pnpm@9.1.1
|
2024-02-28 06:41:26 +00:00
|
|
|
|
|
|
|
COPY . .
|
|
|
|
|
2024-05-18 03:40:45 +00:00
|
|
|
RUN --mount=type=cache,target=/root/.local/share/pnpm/store \
|
|
|
|
pnpm install && pnpm build
|
2024-02-28 06:41:26 +00:00
|
|
|
|
2024-05-18 03:40:45 +00:00
|
|
|
# run
|
|
|
|
FROM base
|
2024-02-28 06:41:26 +00:00
|
|
|
|
|
|
|
COPY package.json .
|
2024-05-18 03:40:45 +00:00
|
|
|
COPY --from=build /app/dist ./dist
|
|
|
|
COPY --from=build /app/scripts ./scripts
|
|
|
|
COPY --from=build /app/prisma ./prisma
|
|
|
|
COPY --from=build /app/node_modules ./node_modules
|
2024-02-28 06:41:26 +00:00
|
|
|
|
|
|
|
# Run the application.
|
2024-05-18 03:40:45 +00:00
|
|
|
CMD npm run start
|