-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
38 lines (31 loc) · 1.32 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
# Stage 1: builder - build typescript into javascript
FROM node:16-alpine as builder
WORKDIR /home/node/catenax-api
COPY . .
RUN npm ci --omit=optional --no-audit && npm run lint && npm run build
# Stage 2: cleaner - prepare image without typescript and dev dependencies
FROM node:16-alpine as cleaner
WORKDIR /home/node/catenax-api
COPY --from=builder /home/node/catenax-api/package*.json ./
COPY --from=builder /home/node/catenax-api/dist ./dist
RUN npm ci --only=production --omit=optional
# Stage 3: final executable image
FROM node:16-alpine
ENV API_PORT=8080
ENV CORS_ALLOW_ORIGIN=http://localhost:3000
ENV DB_HOST=localhost
ENV DB_PORT=5432
ENV DB_USER=dashboard
ENV DB_NAME=dashboard
ENV SENTRY_DSN=
ENV SENTRY_ENVIRONMENT=production
ENV KEYCLOAK_REALM=CX-Central
ENV KEYCLOAK_CLIENT_RESOURCE=Cl9-CDQ-Fraud
ENV KEYCLOAK_CLIENT_ROLE=fraud_app_user
ENV KEYCLOAK_AUTH_URL=https://catenaxintakssrv.germanywestcentral.cloudapp.azure.com/iamcentralidp/auth/realms/CX-Central/protocol/openid-connect/auth
WORKDIR /home/node/catenax-api
COPY --from=cleaner /home/node/catenax-api ./
COPY --from=builder /home/node/catenax-api/src/database/migrations ./src/database/migrations/
EXPOSE $API_PORT
HEALTHCHECK --interval=5m --timeout=10s CMD ["node", "./dist/healthcheck.js"]
CMD ["node", "-r", "source-map-support/register", "./dist/runserver.js"]