-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
56 lines (39 loc) · 1.54 KB
/
Dockerfile
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
FROM positivly/prisma-binaries:latest as prisma
#
# Builder stage.
# This state compile our TypeScript to get the JavaScript code
#
FROM node:20 AS builder
WORKDIR /usr/src/app
COPY . .
RUN curl -sfL https://gobinaries.com/tj/node-prune | bash -s -- -b /usr/local/bin
RUN yarn install --frozen-lockfile --silent --network-timeout 100000
RUN npx prisma generate
RUN yarn build
RUN yarn install --production --frozen-lockfile --silent && /usr/local/bin/node-prune && rm -rf src/
#
# Production stage.
# This state compile get back the JavaScript code from builder stage
# It will also install the production package only
#
FROM node:20-alpine
WORKDIR /app
ENV NODE_ENV=production
ENV NODE_PATH=/app/dist/
## We just need the build to execute the command
COPY --from=builder /usr/src/app/. .
## uncomment following line, if you want to mount the templates folder
#COPY ./templates /app/templates
## uncomment following line, if you want to mount the public folder
#COPY ./public /app/public
# Set prisma environment:
ENV PRISMA_QUERY_ENGINE_BINARY=/prisma-engines/query-engine \
PRISMA_MIGRATION_ENGINE_BINARY=/prisma-engines/migration-engine \
PRISMA_INTROSPECTION_ENGINE_BINARY=/prisma-engines/introspection-engine \
PRISMA_FMT_BINARY=/prisma-engines/prisma-fmt \
PRISMA_CLI_QUERY_ENGINE_TYPE=binary \
PRISMA_CLIENT_ENGINE_TYPE=binary
COPY --from=prisma /prisma-engines/query-engine /prisma-engines/migration-engine /prisma-engines/introspection-engine /prisma-engines/prisma-fmt /prisma-engines/
ENTRYPOINT [ "node" ]
CMD [ "dist/main.js" ]
EXPOSE 3000