-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
98 lines (72 loc) · 2.44 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Build client
FROM node:20.3.0 as client
ARG DEPLOYMENT_ENV=production
ARG DEFAULT_NOTICES=
ARG DEFAULT_TENANT_ADDRESS
ARG SHOW_DEV_WARNING
WORKDIR /nccrd-client
RUN echo "" > .env
RUN echo "DEFAULT_TENANT_ADDRESS=$DEFAULT_TENANT_ADDRESS" >> .env
RUN echo "DEPLOYMENT_ENV=$DEPLOYMENT_ENV" >> .env
RUN echo "DEFAULT_NOTICES=$DEFAULT_NOTICES" >> .env
RUN echo "NCCRD_TECHNICAL_CONTACT=$NCCRD_TECHNICAL_CONTACT" >> .env
RUN echo "HOSTNAME=origin" >> .env
RUN echo "SHOW_DEV_WARNING=$SHOW_DEV_WARNING" >> .env
COPY src/client .
RUN npm ci --only=production
RUN npm run build
# Start API
FROM node:20.3.0-alpine
ARG ODP_AUTH_CLIENT_ID=SAEON.NCCIS
ENV ODP_AUTH_CLIENT_ID=$ODP_AUTH_CLIENT_ID
ARG LOG_SQL_QUERIES=true
ENV LOG_SQL_QUERIES=$LOG_SQL_QUERIES
ARG FILES_DIRECTORY=/nccrd-assets
ENV FILES_DIRECTORY=$FILES_DIRECTORY
ARG LOG_REQUEST_DETAILS=true
ENV LOG_REQUEST_DETAILS=$LOG_REQUEST_DETAILS
ARG ODP_AUTH_CLIENT_SECRET=
ENV ODP_AUTH_CLIENT_SECRET=$ODP_AUTH_CLIENT_SECRET
ENV DEFAULT_SYSADMIN_EMAIL_ADDRESSES=$DEFAULT_SYSADMIN_EMAIL_ADDRESSES
ARG DEFAULT_ADMIN_EMAIL_ADDRESSES=
ENV DEFAULT_ADMIN_EMAIL_ADDRESSES=$DEFAULT_ADMIN_EMAIL_ADDRESSES
ARG DEPLOYMENT_ENV=production
ENV DEPLOYMENT_ENV=$DEPLOYMENT_ENV
ARG SSL_ENV=production
ENV SSL_ENV=$SSL_ENV
ARG MSSQL_USERNAME=sa
ENV MSSQL_USERNAME=$MSSQL_USERNAME
ARG MSSQL_PASSWORD=password!123#
ENV MSSQL_PASSWORD=$MSSQL_PASSWORD
ARG MSSQL_HOSTNAME=localhost
ENV MSSQL_HOSTNAME=$MSSQL_HOSTNAME
ARG MSSQL_DATABASE=nccrd_next
ENV MSSQL_DATABASE=$MSSQL_DATABASE
ARG MSSQL_PORT=1433
ENV MSSQL_PORT=$MSSQL_PORT
ARG HOSTNAME=http://localhost:3001
ENV HOSTNAME=$HOSTNAME
WORKDIR /app
COPY src/api .
COPY --from=client /nccrd-client/dist src/client-dist
RUN npm ci --only=production
EXPOSE 3000
CMD \
LOG_REQUEST_DETAILS=$LOG_REQUEST_DETAILS \
FILES_DIRECTORY=$FILES_DIRECTORY \
LOG_SQL_QUERIES=$LOG_SQL_QUERIES \
DEFAULT_SYSADMIN_EMAIL_ADDRESSES=$DEFAULT_SYSADMIN_EMAIL_ADDRESSES \
ODP_AUTH_CLIENT_ID=$ODP_AUTH_CLIENT_ID \
ODP_AUTH_CLIENT_SECRET=$ODP_AUTH_CLIENT_SECRET \
HOSTNAME=$HOSTNAME \
DEPLOYMENT_ENV=$DEPLOYMENT_ENV \
SSL_ENV=$SSL_ENV \
DEFAULT_ADMIN_EMAIL_ADDRESSES=$DEFAULT_ADMIN_EMAIL_ADDRESSES \
MSSQL_USERNAME=$MSSQL_USERNAME \
MSSQL_PASSWORD=$MSSQL_PASSWORD \
MSSQL_HOSTNAME=$MSSQL_HOSTNAME \
MSSQL_DATABASE=$MSSQL_DATABASE \
MSSQL_PORT=$MSSQL_PORT \
npm run start:prod