forked from radiantearth/stac-browser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (27 loc) · 1.09 KB
/
Dockerfile
File metadata and controls
37 lines (27 loc) · 1.09 KB
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
ARG pathPrefix="/"
FROM node:lts-alpine3.18 AS build-step
ARG DYNAMIC_CONFIG=true
ARG historyMode="history"
ARG pathPrefix
ENV SB_historyMode="${historyMode}"
ENV SB_pathPrefix="${pathPrefix}"
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN \[ "${DYNAMIC_CONFIG}" == "true" \] && sed -i "s|<!-- <script defer=\"defer\" src=\"/runtime-config.js\"></script> -->|<script defer=\"defer\" src=\"${pathPrefix}runtime-config.js\"></script>|g" index.html
RUN npm run build
FROM nginxinc/nginx-unprivileged:1-alpine
ARG pathPrefix
USER root
RUN apk add --no-cache 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
ADD docker/docker-entrypoint.sh /docker-entrypoint.d/40-stac-browser-entrypoint.sh
RUN sed -i "s|<pathPrefix>|${pathPrefix}|" /etc/nginx/conf.d/default.conf && \
chown -R nginx:nginx /usr/share/nginx/html && \
chmod +x /docker-entrypoint.d/40-stac-browser-entrypoint.sh
EXPOSE 8080
STOPSIGNAL SIGTERM
USER nginx