-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
37 lines (33 loc) · 1.01 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
# BASE STAGE
# Prepare node, copy package.json
FROM node:16-alpine AS base
WORKDIR /usr/src/app
COPY package.json package-lock.json ./
# DEPENDENCIES STAGE
# Install production and dev dependencies
FROM base AS dependencies
# install node packages
RUN npm set progress=false && npm config set depth 0
RUN npm install
# TEST STAGE
# run linters, setup and tests
FROM dependencies AS test
COPY . .
RUN npm run prettier:check
# BUILD STAGE
# run NPM build
FROM test as build
# If an app is supposed to be deployed in a subdir, this is the place to specify that
ARG PUBLIC_PATH=/
# Make sure that React app is built using the right path context
ENV PUBLIC_URL=${PUBLIC_PATH}
# Pass SPARQL endpoint var in build time
ARG REACT_APP_SPARQL_ENDPOINT=
ENV REACT_APP_SPARQL_ENDPOINT=${REACT_APP_SPARQL_ENDPOINT}
RUN set -ex; \
npm run build
# RELEASE STAGE
# Only include the static files in the final image
FROM ghcr.io/datagov-cz/react-nginx/react-nginx:latest
WORKDIR /usr/share/nginx/html
COPY --from=build /usr/src/app/build/ ./