-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e20fca8
commit d775309
Showing
4 changed files
with
39 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.git | ||
node_modules | ||
build |
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 |
---|---|---|
@@ -1,5 +1,35 @@ | ||
FROM nginx:1.15.10-alpine | ||
COPY ./build /var/www | ||
#### Stage 1: Build the react application | ||
FROM node:12.4.0-alpine as build | ||
|
||
# Configure the main working directory inside the docker image. | ||
# This is the base directory used in any further RUN, COPY, and ENTRYPOINT | ||
# commands. | ||
WORKDIR /app | ||
|
||
# Copy the package.json as well as the package-lock.json and install | ||
# the dependencies. This is a separate step so the dependencies | ||
# will be cached unless changes to one of those two files | ||
# are made. | ||
COPY package.json package-lock.json ./ | ||
RUN npm install | ||
|
||
# Copy the main application | ||
COPY . ./ | ||
|
||
# Build the application | ||
RUN npm run build | ||
|
||
#### Stage 2: Serve the React application from Nginx | ||
FROM nginx:1.17.0-alpine | ||
|
||
# Copy the react build from Stage 1 | ||
COPY --from=build /app/build /var/www | ||
|
||
# Copy our custom nginx config | ||
COPY nginx.conf /etc/nginx/nginx.conf | ||
|
||
# Expose port 3000 to the Docker host, so we can access it | ||
# from the outside. | ||
EXPOSE 80 | ||
|
||
ENTRYPOINT ["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