-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
50 lines (37 loc) · 935 Bytes
/
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
FROM node:16-alpine AS build
RUN npm i -g pnpm
# Fetch dependencies
COPY pnpm-lock.yaml ./
RUN pnpm fetch
# Copy all files
ADD . .
# Install dependencies from local store
RUN pnpm install --offline
# Generate prisma client
RUN sed -i '5,7d' prisma/schema.prisma
RUN pnpx prisma generate
# Set default environment variables
ENV S3_ENDPOINT=""
ENV S3_REGION=""
ENV S3_BUCKET=""
ENV S3_ACCESS_KEY_ID=""
ENV S3_SECRET_ACCESS_KEY=""
ENV S3_EXPIRATION_TIME=""
ENV KRATOS_PUBLIC_URL=""
ENV KRATOS_PRIVATE_URL=""
ENV KRATOS_ADMIN_URL=""
ENV CDN_PUBLIC_URL=""
ENV DATABASE_URL=""
ENV API_KEY=""
# Build app
RUN pnpm build
# Remove development dependencies
RUN pnpm prune --production
FROM node:16-alpine as app
WORKDIR /app
RUN npm i -g prisma
COPY --from=build ./package.json ./package.json
COPY --from=build ./node_modules ./node_modules
COPY --from=build ./build .
COPY --from=build ./prisma ./prisma
CMD [ "node", "index.js" ]