This repository has been archived by the owner on Nov 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 363
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add production docker running on nginx (#3395)
- Loading branch information
Showing
4 changed files
with
52 additions
and
0 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 |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
.DS_Store | ||
**/.idea | ||
**/dist | ||
*Dockerfile* |
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,18 @@ | ||
server { | ||
listen 80; | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
try_files $uri /index.html; | ||
index index.html index.htm; | ||
} | ||
|
||
location ^~ /app { | ||
alias /usr/share/nginx/html; | ||
try_files $uri /index.html; | ||
index index.html index.htm; | ||
} | ||
|
||
|
||
include /etc/nginx/extra-conf.d/*.conf; | ||
} |
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,29 @@ | ||
FROM node:14 as react-build-step | ||
|
||
# Grab needed environment variables from .env.example | ||
ENV REACT_APP_ENV=production | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y libusb-1.0-0 libusb-1.0-0-dev libudev-dev \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
WORKDIR /app | ||
|
||
COPY package.json yarn.lock . | ||
COPY src/logic/contracts/artifacts ./src/logic/contracts/artifacts | ||
|
||
RUN yarn install | ||
|
||
COPY . . | ||
|
||
RUN yarn build | ||
|
||
# Deploy the build | ||
FROM nginx:1-alpine | ||
|
||
COPY ./docker/nginx.conf /etc/nginx/conf.d/default.conf | ||
COPY --from=react-build-step /app/build /usr/share/nginx/html/ | ||
|
||
EXPOSE 80 | ||
|
||
CMD ["nginx", "-g", "daemon off;"] |