-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
49 lines (36 loc) · 1.02 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
# Setup build image
FROM node:20-buster-slim as buildenv
WORKDIR /source/
RUN npm install -g npm@latest
# Install System Packages
RUN apt-get update
RUN apt-get install ca-certificates -y
# Install npm packages
COPY package.json package-lock.json ./
RUN npm install
# Copy all build files and build
COPY tsconfig.json prisma/ ./
COPY scripts/ ./scripts
RUN chmod +x ./scripts/*
COPY src/ ./src/
RUN npx prisma generate
RUN npm run build
# Run some sentry sourcemap deployment
ARG SENTRY_AUTH_TOKEN
ARG SENTRY_ORG
ARG SENTRY_PROJECT
ARG RAILWAY_GIT_COMMIT_SHA
RUN scripts/sentryDeploy.sh
# Perform postbuild cleanup for production
RUN npm prune --production
# Setup production image
FROM node:20-alpine
# Setup the environment?
WORKDIR /app/
# Install/upgrade some system packages
RUN npm install -g npm@latest
# Copy files from the build env
COPY --from=buildenv /source/dist /app/
COPY --from=buildenv /source/node_modules /app/node_modules/
# Sleep is specifically for railway internal network wait time
CMD sleep 3 && node index.js