-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
79 lines (56 loc) · 1.46 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
FROM node:18-alpine
# Set the working directory
WORKDIR /usr/src/app
# Copy the package.json and package-lock.json files
COPY package.json package-lock.json ./
# Read the environment variables
ARG DATABASE_URL
ARG JWT_SECRET
ARG EMAIL_SERVICE
ARG EMAIL_USER
ARG EMAIL_PASS
ARG EMAIL_HOST
ARG EMAIL_PORT
ARG DEFAULT_ADMIN_EMAIL
ARG DEFAULT_ADMIN_PASSWORD
ARG WEBAPP_HOST=http://localhost:5173
ARG API_PORT
ARG RATE_WINDOW_MINUTES
ARG RATE_MAX_REQS
# Set Environment Variables
ENV DATABASE_URL=$DATABASE_URL
ENV JWT_SECRET=$JWT_SECRET
ENV EMAIL_SERVICE=$EMAIL_SERVICE
ENV EMAIL_USER=$EMAIL_USER
ENV EMAIL_PASS=$EMAIL_PASS
ENV EMAIL_HOST=$EMAIL_HOST
ENV EMAIL_PORT=$EMAIL_PORT
ENV EMAIL_SERVICE=$EMAIL_SERVICE
ENV DEFAULT_ADMIN_EMAIL=$DEFAULT_ADMIN_EMAIL
ENV DEFAULT_ADMIN_PASSWORD=$DEFAULT_ADMIN_PASSWORD
ENV WEBAPP_HOST=$WEBAPP_HOST
ENV API_PORT=$API_PORT
ENV RATE_WINDOW_MINUTES=$RATE_WINDOW_MINUTES
ENV RATE_MAX_REQS=$RATE_MAX_REQS
# Copy the prisma folder to avoid generating the client on every build
COPY prisma ./prisma
# Install dependencies
RUN apk update && apk add --no-cache \
build-base \
g++ \
cairo-dev \
jpeg-dev \
pango-dev \
bash \
imagemagick
RUN npm ci
# Disable Prisma ERD generation
ENV DISABLE_ERD=true
# Generate prisma client
RUN npm run prisma:generate:no-erd
# Copy the rest of the source code
COPY . .
# Expose server port
EXPOSE $API_PORT
# Start the server and migrate the database
CMD [ "npm", "run", "start:migrate:prod" ]