Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nginx setup #77

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
!/src/**
!package.json
!package-lock.json
!nginx.conf
# !.babelrc
!config-overrides.js
!postcss.config.js
Expand Down
20 changes: 19 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14
FROM node:14 as builder_base

WORKDIR discovery-web-ui

Expand All @@ -10,3 +10,21 @@ COPY package.json \
RUN npm ci

COPY . ./

FROM builder_base as builder_production

ARG DATA_HOST
ENV DATA_HOST=${DATA_HOST}

RUN sed -e s@DATA_HOST@$DATA_HOST@g /discovery-web-ui/config/config.js.template > /discovery-web-ui/src/config.js

RUN SKIP_PREFLIGHT_CHECK=true NODE_ENV=production npm run-script build

# production environment
FROM nginx:1.15.7-alpine as production

COPY --from=builder_production /discovery-web-ui/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=builder_production /discovery-web-ui/build /usr/share/nginx/html

CMD ["nginx", "-g", "daemon off;"]

13 changes: 13 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
server {
listen 80;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}