Skip to content

Commit d9ccf51

Browse files
authored
feat: add docker container setup (#727)
1 parent e28d061 commit d9ccf51

File tree

4 files changed

+63
-0
lines changed

4 files changed

+63
-0
lines changed

.dockerignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
coverage
2+
node_modules
3+
build
4+
.env
5+
.yalc
6+
yalc.lock
7+
error.log
8+
npm-debug.log*
9+
yarn-debug.log*
10+
yarn-error.log*

Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# STAGE 1 - run build process
2+
FROM node:14-alpine AS builder-stage
3+
RUN apk update
4+
RUN apk add git
5+
WORKDIR /usr/src/app
6+
COPY package.json yarn.lock ./
7+
RUN yarn install --frozen-lockfile
8+
COPY . .
9+
RUN yarn build
10+
11+
# STAGE 2 - production image
12+
FROM nginx:1.22-alpine as prod-stage
13+
WORKDIR /usr/share/nginx/html
14+
RUN rm -rf ./*
15+
COPY --from=builder-stage /usr/src/app/build ./
16+
COPY --from=builder-stage /usr/src/app/nginx.conf /etc/nginx/conf.d/default.conf
17+
CMD ["nginx", "-g", "daemon off;"]

docker-compose.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
version: '3.7'
2+
3+
services:
4+
node-server:
5+
container_name: yearn-finance-container
6+
image: yearn-finance-image
7+
restart: unless-stopped
8+
build:
9+
context: .
10+
dockerfile: Dockerfile
11+
environment:
12+
NODE_ENV: production
13+
NODE_OPTIONS: --max-old-space-size=4096
14+
REACT_APP_ALCHEMY_API_KEY: ${REACT_APP_ALCHEMY_API_KEY}
15+
REACT_APP_ALLOW_DEV_MODE: ${REACT_APP_ALLOW_DEV_MODE}
16+
REACT_APP_BLOCKNATIVE_KEY: ${REACT_APP_BLOCKNATIVE_KEY}
17+
REACT_APP_ETHERSCAN_API_KEY: ${REACT_APP_ETHERSCAN_API_KEY}
18+
REACT_APP_FORTMATIC_KEY: ${REACT_APP_FORTMATIC_KEY}
19+
REACT_APP_PORTIS_KEY: ${REACT_APP_PORTIS_KEY}
20+
REACT_APP_YEARN_SUBGRAPH_KEY: ${REACT_APP_YEARN_SUBGRAPH_KEY}
21+
REACT_APP_ZAPPER_API_KEY: ${REACT_APP_ZAPPER_API_KEY}
22+
expose:
23+
- '80'
24+
ports:
25+
- '80:80'

nginx.conf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
server {
2+
listen 80;
3+
4+
location / {
5+
root /usr/share/nginx/html;
6+
index index.html index.htm;
7+
try_files $uri $uri/ /index.html =404;
8+
}
9+
10+
include /etc/nginx/extra-conf.d/*.conf;
11+
}

0 commit comments

Comments
 (0)