-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
64 lines (49 loc) · 1.39 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
# Setup build image
FROM node:20-bookworm-slim as buildenv
WORKDIR /source/
RUN npm install -g npm@latest
# Install system build tools
RUN apt-get update
RUN apt-get install python3 make g++ git -y
# Install npm packages
COPY package.json package-lock.json ./
RUN npm ci
# Env Setup
COPY tsconfig.json ./
COPY scripts/ ./scripts
RUN chmod +x ./scripts/*
COPY prisma/ ./
RUN npx prisma generate
# Passthrough git to keep commit hash up to date
COPY .git/ ./.git/
RUN git -C /source/ rev-parse HEAD > "commitHash"
# Build the source
COPY src/ ./src/
COPY build.js ./build.js
RUN npm run build
# Setup sentry source mapping
ARG SENTRY_AUTH_TOKEN
ARG SENTRY_ORG
ARG SENTRY_PROJECT
ENV SENTRY_AUTH_TOKEN=${SENTRY_AUTH_TOKEN}
ENV SENTRY_ORG=${SENTRY_ORG}
ENV SENTRY_PROJECT=${SENTRY_PROJECT}
RUN scripts/sentryDeploy.sh
# Perform build cleanup (or post-build stuff)
RUN npm prune --omit=dev
# Setup production image
FROM node:20-bookworm-slim
# Setup the environment?
WORKDIR /app/
# Install/upgrade some system packages
RUN npm install -g npm@latest
RUN apt-get update
RUN apt-get install fonts-noto ffmpeg -y
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Copy files from the build env
COPY --from=buildenv /source/node_modules /app/node_modules/
COPY --from=buildenv /source/dist /app/
COPY --from=buildenv /source/commitHash /app/commitHash
# Exposed web server port
EXPOSE ${WEBSERVER_PORT}
CMD node loader.js