This repository has been archived by the owner on Dec 12, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
92 lines (72 loc) · 3.3 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# FROM ghcr.io/diced/prisma-binaries:4.8.x as prisma
FROM node:18-alpine as builder
WORKDIR /paperplane
RUN apk add --no-cache libc6-compat
# Install and run Turbo
COPY . .
RUN yarn install
RUN yarn turbo prune --scope=web --docker
RUN yarn turbo prune --scope=server --docker
FROM node:18-alpine as installer
WORKDIR /paperplane
RUN apk add --no-cache libc6-compat
# Prisma binary libraries
# COPY --from=prisma /prisma-engines /prisma-engines
# 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 \
# RUN apk update
# RUN apk add --no-cache libc6-compat
# RUN apk add --no-cache openssl1.1-compat-dev
# Copy yarn executables
COPY .yarnrc.yml ./.yarnrc.yml
COPY --from=builder /paperplane/.yarn ./.yarn
# Copy and install dependencies
COPY --from=builder /paperplane/out/json/ .
COPY --from=builder /paperplane/yarn.lock ./yarn.lock
RUN yarn install
# Copy build files
COPY --from=builder /paperplane/out/full/ .
COPY tsconfig.json ./tsconfig.json
COPY turbo.json turbo.json
COPY tailwind.config.cjs ./tailwind.config.cjs
# Build the application
RUN yarn cmd:server prisma generate
RUN yarn turbo run build
RUN yarn pinst --disable
RUN yarn workspaces focus --production --all
FROM node:18-alpine as runner
WORKDIR /paperplane
# Create user PaperPlane
RUN addgroup --system --gid 1639 paperplane
RUN adduser --system --uid 1639 paperplane
# Copy Prisma Engines
# COPY --from=installer /prisma-engines /prisma-engines
# 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 \
# NEXT_TELEMETRY_DISABLED=1
# Copy build data
COPY --from=installer --chown=paperplane:paperplane /paperplane/apps/web/next.config.mjs ./apps/web/next.config.mjs
COPY --from=installer --chown=paperplane:paperplane /paperplane/apps/web/package.json ./apps/web/package.json
COPY --from=installer --chown=paperplane:paperplane /paperplane/apps/web/.next/ ./apps/web/.next
COPY --chown=paperplane:paperplane apps/web/public/ ./apps/web/public
COPY --from=installer --chown=paperplane:paperplane /paperplane/apps/server/package.json ./apps/server/package.json
COPY --from=installer --chown=paperplane:paperplane /paperplane/apps/server/dist/ ./apps/server/dist/
COPY --chown=paperplane:paperplane apps/server/prisma/ ./apps/server/prisma/
COPY --from=installer --chown=paperplane:paperplane /paperplane/package.json ./package.json
COPY --from=installer --chown=paperplane:paperplane /paperplane/node_modules/ ./node_modules/
COPY --from=installer --chown=paperplane:paperplane /paperplane/node_modules/.prisma/client ./node_modules/.prisma/client
COPY --from=installer --chown=paperplane:paperplane /paperplane/node_modules/@prisma/client ./node_modules/@prisma/client
# Create data folder
RUN mkdir /paperplane/data
RUN chown -R paperplane:paperplane /paperplane/data
USER paperplane
# Start app
CMD yarn start