-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
85 lines (76 loc) · 3.33 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
###############
# #
# Build Stage #
# #
###############
FROM node:18.17.0 AS build_stage
# Install global dependencies.
RUN apt-get update && apt-get install -y build-essential
# Copy all project files.
WORKDIR /app
COPY ./projects projects
COPY ./scripts scripts
# Run the startup script, without starting the server.
# This script:
# - Installs dependencies.
# - Builds the UI.
# - Moves the UI build folder to the server project.
# - Inserts an EJS view engine variable into the UI build,
# so that the server can send the live environment variables
# along with the UI when the build is served.
RUN START_SERVER=false sh ./scripts/startup.sh
###############
# #
# Serve Stage #
# #
###############
FROM node:18.17.0 AS serve_stage
ENV VITE_PORTAL_SERVER_URL=$VITE_PORTAL_SERVER_URL \
VITE_CLIENT_ID=$VITE_CLIENT_ID \
VITE_TOKEN_ENDPOINT=$VITE_TOKEN_ENDPOINT \
VITE_AUTH_ENDPOINT=$VITE_AUTH_ENDPOINT \
VITE_LOGOUT_ENDPOINT=$VITE_LOGOUT_ENDPOINT \
VITE_APPLIED_OIDC_AUTH_CODE_CONFIG=$VITE_APPLIED_OIDC_AUTH_CODE_CONFIG \
VITE_OIDC_AUTH_CODE_CONFIG_CALLBACK_PATH=$VITE_OIDC_AUTH_CODE_CONFIG_CALLBACK_PATH \
VITE_OIDC_AUTH_CODE_CONFIG_LOGOUT_PATH=$VITE_OIDC_AUTH_CODE_CONFIG_LOGOUT_PATH \
VITE_SWAGGER_CONFIG_URL=$VITE_SWAGGER_CONFIG_URL \
VITE_AUDIENCE=$VITE_AUDIENCE \
VITE_HOME_IMAGE_URL=$VITE_HOME_IMAGE_URL \
VITE_BANNER_IMAGE_URL=$VITE_BANNER_IMAGE_URL \
VITE_LOGO_IMAGE_URL=$VITE_LOGO_IMAGE_URL \
VITE_COMPANY_NAME=$VITE_COMPANY_NAME \
VITE_CUSTOM_PAGES=$VITE_CUSTOM_PAGES \
VITE_SWAGGER_PREFILL_API_KEY=$VITE_SWAGGER_PREFILL_API_KEY \
VITE_SWAGGER_PREFILL_OAUTH=$VITE_SWAGGER_PREFILL_OAUTH \
VITE_SWAGGER_PREFILL_BASIC=$VITE_SWAGGER_PREFILL_BASIC \
VITE_DEFAULT_APP_AUTH=$VITE_DEFAULT_APP_AUTH \
VITE_API_PAGE_RELOAD=$VITE_API_PAGE_RELOAD
# Copy the server files, (this includes the UI build).
WORKDIR /app
COPY --from=build_stage /app/projects/server .
# Pass through the environment variables, and then start the server.
# These variables will change when the image is deployed.
# This needs to be `node ./bin/www` instead of `yarn start because
# running yarn causes a yarn cache file to change, which doesn't work
# in read-only environments.
ENTRYPOINT VITE_PORTAL_SERVER_URL=$VITE_PORTAL_SERVER_URL \
VITE_CLIENT_ID=$VITE_CLIENT_ID \
VITE_TOKEN_ENDPOINT=$VITE_TOKEN_ENDPOINT \
VITE_AUTH_ENDPOINT=$VITE_AUTH_ENDPOINT \
VITE_LOGOUT_ENDPOINT=$VITE_LOGOUT_ENDPOINT \
VITE_APPLIED_OIDC_AUTH_CODE_CONFIG=$VITE_APPLIED_OIDC_AUTH_CODE_CONFIG \
VITE_OIDC_AUTH_CODE_CONFIG_CALLBACK_PATH=$VITE_OIDC_AUTH_CODE_CONFIG_CALLBACK_PATH \
VITE_OIDC_AUTH_CODE_CONFIG_LOGOUT_PATH=$VITE_OIDC_AUTH_CODE_CONFIG_LOGOUT_PATH \
VITE_SWAGGER_CONFIG_URL=$VITE_SWAGGER_CONFIG_URL \
VITE_AUDIENCE=$VITE_AUDIENCE \
VITE_HOME_IMAGE_URL=$VITE_HOME_IMAGE_URL \
VITE_BANNER_IMAGE_URL=$VITE_BANNER_IMAGE_URL \
VITE_LOGO_IMAGE_URL=$VITE_LOGO_IMAGE_URL \
VITE_COMPANY_NAME=$VITE_COMPANY_NAME \
VITE_CUSTOM_PAGES=$VITE_CUSTOM_PAGES \
VITE_SWAGGER_PREFILL_API_KEY=$VITE_SWAGGER_PREFILL_API_KEY \
VITE_SWAGGER_PREFILL_OAUTH=$VITE_SWAGGER_PREFILL_OAUTH \
VITE_SWAGGER_PREFILL_BASIC=$VITE_SWAGGER_PREFILL_BASIC \
VITE_DEFAULT_APP_AUTH=$VITE_DEFAULT_APP_AUTH \
VITE_API_PAGE_RELOAD=$VITE_API_PAGE_RELOAD \
node ./bin/www