forked from radiantearth/stac-browser
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
31 lines (22 loc) · 988 Bytes
/
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
ARG pathPrefix="/"
FROM node:lts-alpine3.18 AS build-step
ARG DYNAMIC_CONFIG=true
ARG historyMode="history"
ARG pathPrefix
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN \[ "${DYNAMIC_CONFIG}" == "true" \] && sed -i "s|<!-- <script defer=\"defer\" src=\"/config.js\"></script> -->|<script defer=\"defer\" src=\"${pathPrefix}config.js\"></script>|g" public/index.html
RUN npm run build -- --historyMode="${historyMode}" --pathPrefix="${pathPrefix}"
FROM nginx:1-alpine-slim
ARG pathPrefix
RUN apk add jq pcre-tools
COPY ./config.schema.json /etc/nginx/conf.d/config.schema.json
COPY --from=build-step /app/dist /usr/share/nginx/html
COPY --from=build-step /app/docker/default.conf /etc/nginx/conf.d/default.conf
RUN sed -i "s|<pathPrefix>|${pathPrefix}|" /etc/nginx/conf.d/default.conf
EXPOSE 8080
STOPSIGNAL SIGTERM
# override entrypoint, which calls nginx-entrypoint underneath
ADD docker/docker-entrypoint.sh /docker-entrypoint.d/40-stac-browser-entrypoint.sh