forked from woolimi/hypertube
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.back
40 lines (35 loc) · 961 Bytes
/
Dockerfile.back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
FROM node:lts-slim AS base
WORKDIR /usr/src/app
RUN npm i -g pnpm @nestjs/cli
FROM base AS dependencies
COPY ./back/package.json ./
COPY ./back/*-lock.yaml ./
RUN mkdir -p /.pnpm-store && \
pnpm config set store-dir /.pnpm-store && \
pnpm install --prod=false
FROM dependencies AS development
CMD ["pnpm", "run", "dev"]
EXPOSE 5000
FROM dependencies AS build
COPY ./back .
RUN pnpm run build
# COPY ./back/setup-database.sh ./
# RUN chmod +x ./setup-database.sh
# CMD ["./setup-database.sh"]
FROM base AS production
WORKDIR /usr/src/app
COPY ./back/ ./
COPY --from=dependencies /usr/src/app/ ./node_modules
# RUN pnpm run db:migrate
# RUN pnpm prune --prod
ENV NODE_ENV=production
COPY --from=build /usr/src/app/dist ./dist
# RUN pnpm prune --prod
RUN pnpm install --prod
ENTRYPOINT [ "/usr/src/app/startup.sh" ]
EXPOSE 5000
# FROM build AS production
# ENV NODE_ENV=production
# RUN pnpm prune --prod
# CMD [ "node", "dist/src/main.js" ]
# EXPOSE 5000