forked from ProgSoc/DiscordVerify
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (40 loc) · 1.79 KB
/
Dockerfile
File metadata and controls
47 lines (40 loc) · 1.79 KB
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
# Deps
FROM node:19-alpine as basebackend
WORKDIR /app
# RUN apk update --no-cache
# RUN apk add --no-cache python3 make gcc g++ bash curl
COPY package.json yarn.lock tsconfig.json ./
COPY packages/backend/package.json packages/backend/tsconfig.json packages/backend/tsup.config.ts packages/backend/prisma ./packages/backend/
FROM node:19-alpine as basefrontend
WORKDIR /app
# RUN apk update --no-cache
# RUN apk add --no-cache python3 make gcc g++ bash curl
COPY package.json yarn.lock tsconfig.json ./
COPY packages/frontend/package.json packages/frontend/tsconfig.json packages/frontend/tsconfig.node.json packages/frontend/vite.config.ts packages/frontend/index.html ./packages/frontend/
FROM basefrontend as buildfrontend
WORKDIR /app
RUN yarn workspace frontend install --frozen-lockfile
COPY packages/frontend/src ./packages/frontend/src
RUN yarn workspace frontend build
# Build Backend
FROM basebackend as buildbackend
WORKDIR /app
RUN yarn workspace backend install --frozen-lockfile
COPY packages/backend/src ./packages/backend/src
COPY --from=buildfrontend /app/packages/frontend/dist ./packages/backend/public
RUN yarn workspace backend generate
RUN yarn workspace backend build
# Runner
FROM basebackend as runner
WORKDIR /app
ENV NODE_ENV="production"
ENV DATABASE_URL="file:/app/config/db.sqlite"
ENV CONFIG_DIR="/app/config"
COPY --from=buildbackend /app/node_modules/.prisma /app/node_modules/.prisma
COPY --from=buildbackend /app/packages/backend/dist packages/backend/dist
COPY --from=buildbackend /app/packages/backend/public packages/backend/public
# TODO: the above key changes on every build, so we need to find a way to persist it
# COPY --from=build /app/prisma prisma
EXPOSE 3000
RUN yarn install --production --frozen-lockfile
CMD yarn workspace backend migrate && yarn workspace backend start