File tree Expand file tree Collapse file tree 2 files changed +25
-6
lines changed
Expand file tree Collapse file tree 2 files changed +25
-6
lines changed Original file line number Diff line number Diff line change @@ -15,18 +15,17 @@ COPY . .
1515RUN yarn build
1616
1717
18+ FROM mikefarah/yq AS yq
1819FROM nginx:stable-alpine AS prod
1920
2021COPY ./docker/nginx.conf /etc/nginx/conf.d/default.conf
2122COPY --from=build /app/dist /usr/share/nginx/html
2223
2324COPY ./docker/entrypoint.sh /entrypoint.sh
24- RUN chmod +x /entrypoint.sh
25+ COPY --from=yq /usr/bin/yq /usr/bin/yq
26+ RUN chmod +x /entrypoint.sh /usr/bin/yq
2527
26- ARG API_URL=http://localhost:8000
27- ARG AUTH_PROVIDER=dummyAuthProvider
28- ENV SYNCMASTER__UI__API_BROWSER_URL=${API_URL}
29- ENV SYNCMASTER__UI__AUTH_PROVIDER=${AUTH_PROVIDER}
28+ ENV SYNCMASTER_CONFIG_FILE=/app/config.yaml
3029
3130ENTRYPOINT ["/entrypoint.sh" ]
3231CMD ["nginx" , "-g" , "daemon off;" ]
Original file line number Diff line number Diff line change 11#! /bin/sh
22
3+ SYNCMASTER_CONFIG_FILE=${SYNCMASTER_CONFIG_FILE:-/ app/ config.yaml}
4+ SYNCMASTER__UI__API_BROWSER_URL_DEFAULT=" http://localhost:8000"
5+ SYNCMASTER__UI__AUTH_PROVIDER_DEFAULT=" dummyAuthProvider"
6+
7+ if [[ -z " ${SYNCMASTER__UI__API_BROWSER_URL} " ]]; then
8+ if [[ -f " $SYNCMASTER_CONFIG_FILE " ]]; then
9+ SYNCMASTER__UI__API_BROWSER_URL=$( yq --raw-output " .ui.api_browser_url // \" $SYNCMASTER__UI__API_BROWSER_URL_DEFAULT \" " " $SYNCMASTER_CONFIG_FILE " )
10+ else
11+ SYNCMASTER__UI__API_BROWSER_URL=" $SYNCMASTER__UI__API_BROWSER_URL_DEFAULT "
12+ fi
13+ fi
14+
15+ if [[ -z " ${SYNCMASTER__UI__AUTH_PROVIDER} " ]]; then
16+ if [[ -f " $SYNCMASTER_CONFIG_FILE " ]]; then
17+ SYNCMASTER__UI__AUTH_PROVIDER=$( yq --raw-output " .ui.auth_provider // \" $SYNCMASTER__UI__AUTH_PROVIDER_DEFAULT \" " " $SYNCMASTER_CONFIG_FILE " )
18+ else
19+ SYNCMASTER__UI__AUTH_PROVIDER=" $SYNCMASTER__UI__AUTH_PROVIDER_DEFAULT "
20+ fi
21+ fi
22+
323cat << EOF > /usr/share/nginx/html/env-config.js
424window.env = {
525 API_URL: "${SYNCMASTER__UI__API_BROWSER_URL} ",
929
1030sed -i ' /<\/head>/i \ <script src="/env-config.js"></script>' /usr/share/nginx/html/index.html
1131
12- exec " $@ "
32+ exec " $@ "
You can’t perform that action at this time.
0 commit comments