2021-03-23 10:07:46 +00:00
|
|
|
ARG DEFAULT_KEYCLOAK_ENDPOINT='http:\/\/localhost:8180'
|
|
|
|
|
2021-04-30 08:43:23 +00:00
|
|
|
FROM node:16 as builder
|
2021-03-23 10:07:46 +00:00
|
|
|
|
|
|
|
ARG DEFAULT_KEYCLOAK_ENDPOINT
|
|
|
|
ARG KEYCLOAK_ENDPOINT
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
COPY . .
|
|
|
|
|
|
|
|
# replace Keycloak endpoints
|
2021-07-15 20:56:25 +00:00
|
|
|
RUN sed -i "s/${DEFAULT_KEYCLOAK_ENDPOINT}/${KEYCLOAK_ENDPOINT}/g" import.mjs &&\
|
2021-03-23 10:07:46 +00:00
|
|
|
sed -i "s/${DEFAULT_KEYCLOAK_ENDPOINT}/${KEYCLOAK_ENDPOINT}/g" src/context/auth/keycloak.ts &&\
|
2021-07-07 14:24:03 +00:00
|
|
|
sed -i "s/adminv2//g" snowpack.config.js
|
|
|
|
|
|
|
|
# install dependencies and build application
|
|
|
|
RUN npm ci
|
|
|
|
RUN npm run build
|
2021-03-23 10:07:46 +00:00
|
|
|
|
|
|
|
FROM nginx:stable
|
|
|
|
ARG DEFAULT_KEYCLOAK_ENDPOINT
|
|
|
|
ARG KEYCLOAK_ENDPOINT
|
|
|
|
|
|
|
|
COPY --from=builder /app/build /usr/share/nginx/html
|
|
|
|
|
|
|
|
# setup reverse proxy for Keycloak endpoint
|
|
|
|
COPY nginx-default.conf /etc/nginx/conf.d/default.conf
|
|
|
|
|
|
|
|
# replace Keycloak endpoints
|
|
|
|
RUN sed -i "s/${DEFAULT_KEYCLOAK_ENDPOINT}/${KEYCLOAK_ENDPOINT}/g" /etc/nginx/conf.d/default.conf
|
|
|
|
|
|
|
|
EXPOSE 80
|