Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Commit

Permalink
Add production docker running on nginx (#3395)
Browse files Browse the repository at this point in the history
  • Loading branch information
Uxio0 authored Feb 14, 2022
1 parent 92ee4e7 commit fc14b41
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
.DS_Store
**/.idea
**/dist
*Dockerfile*
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Define environment
REACT_APP_ENV=

# For all environments
REACT_APP_GATEWAY_URL=
REACT_APP_GOOGLE_ANALYTICS=
REACT_APP_INFURA_TOKEN=
REACT_APP_IPFS_GATEWAY=https://ipfs.io/ipfs
Expand Down
18 changes: 18 additions & 0 deletions docker/nginx.conf
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;
}
29 changes: 29 additions & 0 deletions prod.Dockerfile
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;"]

0 comments on commit fc14b41

Please sign in to comment.