Add Dockerfile
This commit is contained in:
24
.dockerignore
Normal file
24
.dockerignore
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
**/.classpath
|
||||||
|
**/.dockerignore
|
||||||
|
**/.env
|
||||||
|
**/.git
|
||||||
|
**/.gitignore
|
||||||
|
**/.project
|
||||||
|
**/.settings
|
||||||
|
**/.toolstarget
|
||||||
|
**/.vs
|
||||||
|
**/.vscode
|
||||||
|
**/*.*proj.user
|
||||||
|
**/*.dbmdl
|
||||||
|
**/*.jfm
|
||||||
|
**/azds.yaml
|
||||||
|
**/bin
|
||||||
|
**/charts
|
||||||
|
**/docker-compose*
|
||||||
|
**/Dockerfile*
|
||||||
|
**/node_modules
|
||||||
|
**/npm-debug.log
|
||||||
|
**/obj
|
||||||
|
**/secrets.dev.yaml
|
||||||
|
**/values.dev.yaml
|
||||||
|
README.md
|
||||||
35
Dockerfile
Normal file
35
Dockerfile
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# ================================
|
||||||
|
# Create image to build project
|
||||||
|
FROM node:12-alpine as builder
|
||||||
|
|
||||||
|
# copy the package.json to install dependencies
|
||||||
|
COPY package.json package-lock.json ./
|
||||||
|
COPY .env.template ./.env
|
||||||
|
|
||||||
|
# Install the dependencies and make the folder
|
||||||
|
RUN npm install && mkdir /react-ui && mv ./node_modules ./react-ui
|
||||||
|
|
||||||
|
WORKDIR /react-ui
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Build the project and copy the files
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# ================================
|
||||||
|
# Create image to serve react app
|
||||||
|
FROM nginx:latest
|
||||||
|
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
COPY ./nginx.conf /etc/nginx/nginx.conf
|
||||||
|
|
||||||
|
## Remove default nginx index page
|
||||||
|
RUN rm -rf /usr/share/nginx/html/*
|
||||||
|
|
||||||
|
# Copy from the stahg 1
|
||||||
|
COPY --from=builder /react-ui/build /usr/share/nginx/html
|
||||||
|
|
||||||
|
EXPOSE 80 443 8080
|
||||||
|
|
||||||
|
ENTRYPOINT ["nginx", "-g", "daemon off;"]
|
||||||
13
nginx.conf
Normal file
13
nginx.conf
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
events { worker_connections 1024; }
|
||||||
|
|
||||||
|
http {
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri /index.html;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user