-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
70 lines (49 loc) · 1.5 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
FROM node:18.18.2-slim AS base
# Name for the version/release of the software. (Optional)
ARG RELEASE
# FIXME: This repo is no longer actively maintained! If you start using it, you
# should re-enable this, which may also require updating the Node.js version.
# Upgrade to latest NPM.
# RUN npm install -g npm
WORKDIR /app
# Install dependencies
COPY package.json package-lock.json ./
COPY ./loader/package.json ./loader/
COPY ./common/package.json ./common/
COPY ./server/package.json ./server/
RUN npm ci
# copy our files
COPY . .
ENV RELEASE="${RELEASE}"
# Loader ---------------------------------------------------------
FROM base AS loader
# Build for production.
ENV NODE_ENV=production
RUN npm run build --workspace common
# Clear dev-only dependencies.
RUN npm prune --omit=dev
WORKDIR /app/loader
# required exposed env vars
ENV API_URL=""
ENV API_KEY=""
# Run the loader
ENTRYPOINT ["node", "./bin/univaf-loader", "--send", "--compact"]
# Server ---------------------------------------------------------
FROM base AS server
# Build for production.
ENV NODE_ENV=production
RUN npm run build --workspace server
# Clear dev-only dependencies.
RUN npm prune --omit=dev
WORKDIR /app/server
EXPOSE 3000
# optional exposed env vars, the defaults are provided here.
ENV DB_HOST=postgres
ENV DB_USERNAME=postgres
ENV DB_PASSWORD=password
ENV DB_PORT=5432
# required exposed env vars, with defaults provided
ENV API_KEYS=""
ENV DB_NAME="univaf"
# run our built server
CMD npm run migrate && node ./dist/src/server.js