Skip to content

Commit b399f79

Browse files
author
Mike Upton
committed
Adding docker stuffs
1 parent ad222fa commit b399f79

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

.dockerignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.git
2+
node_modules
3+
build

Dockerfile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Build Stage -> Packaging up the React Project to be Served by Nginx
2+
FROM node:alpine as builder
3+
WORKDIR /app
4+
COPY . ./
5+
RUN npm install
6+
RUN npm run build
7+
8+
# Serve Stage -> Serving the built React content
9+
FROM nginx:alpine
10+
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
11+
COPY --from=builder /app/build /usr/share/nginx/html
12+
EXPOSE 80
13+
CMD ["nginx", "-g", "daemon off;"]

nginx/nginx.conf

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
server {
2+
listen 80;
3+
server_name localhost;
4+
location / {
5+
root /usr/share/nginx/html;
6+
index index.html index.htm;
7+
try_files $uri /index.html;
8+
}
9+
error_page 500 502 503 504 /50x.html;
10+
location = /50x.html {
11+
root /usr/share/nginx/html;
12+
}
13+
}

0 commit comments

Comments
 (0)