forked from gchq/Kai
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Gh 07 dockerise ui
- Loading branch information
Showing
5 changed files
with
67 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# STAGE 1 - BUILD UI APP | ||
FROM node:13.12.0-alpine as build | ||
|
||
# specify /app working directory inside the image | ||
WORKDIR /app | ||
# add node_modules | ||
ENV PATH /app/node_modules/.bin:$PATH | ||
# copy package & package-lock json to app/ inside the image | ||
COPY ./package*.json /app/ | ||
# install npm dependencies | ||
RUN npm install --silent | ||
# copy all code to app/ directory inside the image | ||
COPY . /app | ||
# build app | ||
RUN npm run build | ||
|
||
|
||
# STAGE 2 - Build IMAGE & COPY REACT UI BUILD FILES | ||
FROM nginx:1.17.8-alpine | ||
|
||
# copy build files inside the image to directory where Nginx serves from | ||
COPY --from=build /app/build /usr/share/nginx/html | ||
# remove the default Nginx configuration file | ||
RUN rm /etc/nginx/conf.d/default.conf | ||
# copy Nginx config file to the ui image | ||
COPY nginx/nginx.conf /etc/nginx/conf.d | ||
# expose port 80 for the Nginx server to listen to | ||
EXPOSE 80 | ||
# run Nginx in foreground and not as daemon | ||
CMD ["nginx", "-g", "daemon off;"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
server { | ||
|
||
listen 80; | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html index.htm; | ||
|
||
# to redirect all the requests to index.html, | ||
# useful when you are using react-router | ||
|
||
try_files $uri /index.html; | ||
} | ||
|
||
error_page 500 502 503 504 /50x.html; | ||
|
||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
|
||
} |