-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDockerfile
131 lines (100 loc) · 3.25 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# ===============================================
FROM registry.access.redhat.com/ubi9/nodejs-18 AS appbase
# ===============================================
WORKDIR /app
USER root
RUN curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo
RUN yum -y install yarn
# Offical image has npm log verbosity as info. More info - https://github.com/nodejs/docker-node#verbosity
ENV NPM_CONFIG_LOGLEVEL warn
# set our node environment, either development or production
# defaults to production, compose overrides this to development on build and run
ARG NODE_ENV=production
ENV NODE_ENV $NODE_ENV
# Yarn
ENV YARN_VERSION 1.22.5
RUN yarn policies set-version $YARN_VERSION
COPY package.json yarn.lock /app/
RUN chown -R default:root /app
USER default
# Install dependencies
RUN yarn && yarn cache clean --force
# Copy all necessary files
COPY index.html vite.config.ts tsconfig.json .eslintignore .eslintrc.json .prettierrc.json .env* /app/
COPY /public/ /app/public
COPY /scripts/ /app/scripts
COPY /src/ /app/src
# =============================
FROM appbase AS development
# =============================
WORKDIR /app
# Set NODE_ENV to development in the development container
ARG NODE_ENV=development
ENV NODE_ENV $NODE_ENV
ENV PORT 8000
# Bake package.json start command into the image
CMD yarn start --port ${PORT}
EXPOSE 8000
# ===================================
FROM appbase AS staticbuilder
# ===================================
WORKDIR /app
# Set public url
ARG PUBLIC_URL
# Set generate sitemap and generate robots flag
ARG GENERATE_SITEMAP
ARG GENERATE_ROBOTS
# Set LinkedEvents url
ARG REACT_APP_LINKED_EVENTS_URL
# Set LinkedRegistrations UI url
ARG REACT_APP_LINKED_REGISTRATIONS_UI_URL
# Set OIDC settings
ARG REACT_APP_OIDC_AUTHORITY
ARG REACT_APP_OIDC_API_TOKENS_URL
ARG REACT_APP_OIDC_CLIENT_ID
ARG REACT_APP_OIDC_API_SCOPE
# Set Sentry settings
ARG REACT_APP_SENTRY_DSN
ARG REACT_APP_SENTRY_ENVIRONMENT
# Set Matomo settings
ARG REACT_APP_MATOMO_SRC_URL
ARG REACT_APP_MATOMO_URL_BASE
ARG REACT_APP_MATOMO_SITE_ID
ARG REACT_APP_MATOMO_ENABLED
# Internet place id
ARG REACT_APP_INTERNET_PLACE_ID
# Remote participation keyword id
ARG REACT_APP_REMOTE_PARTICIPATION_KEYWORD_ID
# Data source of new linked events objects
ARG REACT_APP_LINKED_EVENTS_SYSTEM_DATA_SOURCE
# Allowed domain for the substitute user
ARG REACT_APP_ALLOWED_SUBSTITUTE_USER_DOMAINS
# Swagger URL
ARG REACT_APP_SWAGGER_URL
# Feature flags
ARG REACT_APP_SHOW_ADMIN
ARG REACT_APP_SHOW_PLACE_PAGES
ARG REACT_APP_ENABLE_SWEDISH_TRANSLATIONS
ARG REACT_APP_ENABLE_EXTERNAL_USER_EVENTS
ARG REACT_APP_MAINTENANCE_SHOW_NOTIFICATION
ARG REACT_APP_MAINTENANCE_DISABLE_LOGIN
ARG REACT_APP_WEB_STORE_INTEGRATION_ENABLED
# Vite/Rollup build args
ARG ROLLUP_INLINE_DYNAMIC_IMPORTS
RUN yarn build
RUN yarn generate-sitemap
RUN yarn generate-robots
RUN yarn compress
# =============================
FROM registry.access.redhat.com/ubi9/nginx-120 AS production
# =============================
USER root
RUN chgrp -R 0 /usr/share/nginx/html && \
chmod -R g=u /usr/share/nginx/html
# Copy static build
COPY --from=staticbuilder /app/build /usr/share/nginx/html
# Copy nginx config
COPY .prod/nginx.conf /etc/nginx/nginx.conf
USER 1001
CMD ["/bin/bash", "-c", "nginx -g \"daemon off;\""]
EXPOSE 8000