File tree 4 files changed +39
-4
lines changed
4 files changed +39
-4
lines changed Original file line number Diff line number Diff line change
1
+ .git
2
+ node_modules
3
+ build
Original file line number Diff line number Diff line change 1
- FROM nginx:1.15.10-alpine
2
- COPY ./build /var/www
1
+ # ### Stage 1: Build the react application
2
+ FROM node:12.4.0-alpine as build
3
+
4
+ # Configure the main working directory inside the docker image.
5
+ # This is the base directory used in any further RUN, COPY, and ENTRYPOINT
6
+ # commands.
7
+ WORKDIR /app
8
+
9
+ # Copy the package.json as well as the package-lock.json and install
10
+ # the dependencies. This is a separate step so the dependencies
11
+ # will be cached unless changes to one of those two files
12
+ # are made.
13
+ COPY package.json package-lock.json ./
14
+ RUN npm install
15
+
16
+ # Copy the main application
17
+ COPY . ./
18
+
19
+ # Build the application
20
+ RUN npm run build
21
+
22
+ # ### Stage 2: Serve the React application from Nginx
23
+ FROM nginx:1.17.0-alpine
24
+
25
+ # Copy the react build from Stage 1
26
+ COPY --from=build /app/build /var/www
27
+
28
+ # Copy our custom nginx config
3
29
COPY nginx.conf /etc/nginx/nginx.conf
30
+
31
+ # Expose port 3000 to the Docker host, so we can access it
32
+ # from the outside.
4
33
EXPOSE 80
34
+
5
35
ENTRYPOINT ["nginx" ,"-g" ,"daemon off;" ]
Original file line number Diff line number Diff line change @@ -24,11 +24,13 @@ http {
24
24
server {
25
25
# listen on port 80
26
26
listen 80 ;
27
+
27
28
# save logs here
28
29
access_log /var/log/nginx/access.log compression;
29
30
30
- # where the root here
31
+ # nginx root directory
31
32
root /var/www;
33
+
32
34
# what file to server as index
33
35
index index.html index.htm;
34
36
Original file line number Diff line number Diff line change 14
14
<parent >
15
15
<groupId >org.springframework.boot</groupId >
16
16
<artifactId >spring-boot-starter-parent</artifactId >
17
- <version >2.0.0 .RELEASE</version >
17
+ <version >2.1.6 .RELEASE</version >
18
18
<relativePath /> <!-- lookup parent from repository -->
19
19
</parent >
20
20
You can’t perform that action at this time.
0 commit comments