Skip to content

Commit

Permalink
chore: divide Dockerfile into smaller pieces
Browse files Browse the repository at this point in the history
  • Loading branch information
pociej committed May 7, 2024
1 parent 23fa8bb commit 93eb8e4
Show file tree
Hide file tree
Showing 9 changed files with 204 additions and 40 deletions.
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"dev": "concurrently -k \"tsc -w\" \"nodemon --env-file=.env.local ./dist/index.js\"",
"devscx": "tsc && node --env-file=.env.local ./dist/index.js",
"build": "tsc",
"start": "node ./dist/index.js"
"start": "pm2 start ./dist/index.js -i max"
},
"type": "module",
"keywords": [],
Expand Down
3 changes: 3 additions & 0 deletions deploy/backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM node:20-alpine
RUN npm install pm2 -g
CMD ["pm2-runtime", "./dist/index.js"]
23 changes: 3 additions & 20 deletions deploy/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@ services:
# application service
backend:
build:
context: ./yagna
context: ./backend
dockerfile: Dockerfile
args:
- YAGNA_VERSION=pre-rel-v0.15.0-deposits-beta4
command: pnpm run start
working_dir: /app/backend
environment:
- YAGNA_APPKEY=${YAGNA_APPKEY}
- YAGNA_API_URL=http://yagna:7465
- GSB_URL=tcp://yagna:7464
- JWT_SECRET=dup]a
- JWT_SECRET=dupa
- JWT_TOKEN_EXPIRATION=1d
- JWT_REFRESH_TOKEN_EXPIRATION=7d
- JWT_ISSUER=golem.network
Expand All @@ -31,26 +28,12 @@ services:

frontend:
build:
context: ./yagna
context: ./frontend
dockerfile: Dockerfile
args:
- YAGNA_VERSION=pre-rel-v0.15.0-deposits-beta4
command: pnpm run start
working_dir: /app/frontend
environment:
- YAGNA_APPKEY=${YAGNA_APPKEY}
- YAGNA_API_URL=http://yagna:7465
- GSB_URL=tcp://yagna:7464
- JWT_SECRET=dup]a
- JWT_TOKEN_EXPIRATION=1d
- JWT_REFRESH_TOKEN_EXPIRATION=7d
- JWT_ISSUER=golem.network
- MONGO_URI=mongodb://${MONGO_ROOT_USER}:${MONGO_ROOT_PASSWORD}@mongo:27017/
- HOST=0.0.0.0
- PORT=5174
- DB_NAME=depositDB
- DEPOSIT_CONTRACT_ADDRESS=0xA3D86ebF4FAC94114526f4D09C3fA093898347a6

ports:
- "3000:3000"
depends_on:
Expand Down
2 changes: 2 additions & 0 deletions deploy/frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM node:20-alpine
RUN npm install -g pnpm serve
30 changes: 13 additions & 17 deletions deploy/yagna/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
# Full python toolset for ease of development
# If you need something smaller, you can use ubuntu slim or alpine without python
FROM node:20-bullseye

# This tools are not needed but are helpful for debugging
RUN apt-get update -y
RUN apt-get install -y build-essential net-tools iputils-ping curl vim git wget unzip jq dnsutils tcpdump
RUN npm install -g pnpm serve pm2
# FROM scratch
# COPY curl /curl
# ENTRYPOINT ["/curl"]

# Download official installer
RUN curl -L https://join.golem.network/as-requestor --output as-requestor.sh
RUN chmod +x as-requestor.sh
# # Download official installer
# RUN curl -L https://join.golem.network/as-requestor --output as-requestor.sh
# RUN chmod +x as-requestor.sh

# Installer is checking if binaries in in this PATH, so we need to add it beforehand
ENV PATH="${PATH}:/root/.local/bin"
# # Installer is checking if binaries in in this PATH, so we need to add it beforehand
# ENV PATH="${PATH}:/root/.local/bin"

# switch to any yagna version if necessery
ARG YAGNA_VERSION

# yagna installator normally asks for user input, so we need to set some environment variables to avoid that
RUN GOLEM_ACCEPT_TOS=yes BATCH_MODE=yes YA_INSTALLER_CORE=${YAGNA_VERSION} ./as-requestor.sh
# # switch to any yagna version if necessery
# ARG YAGNA_VERSION

# # yagna installator normally asks for user input, so we need to set some environment variables to avoid that
# RUN GOLEM_ACCEPT_TOS=yes BATCH_MODE=yes YA_INSTALLER_CORE=${YAGNA_VERSION} ./as-requestor.sh



FROM golemfactory/requestor:0.15.0
1 change: 0 additions & 1 deletion frontend/.env.development
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
VITE_BACKEND_URL=http://127.0.0.1:5174
VITE_REQUESTOR_WALLET_ADDRESS=0x2df23cf840a1149646c7eaa426b493db808d31af
1 change: 1 addition & 0 deletions frontend/.env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_BACKEND_URL=http://0.0.0.0:5174
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@web3modal/wagmi": "4.0.13",
"axios": "^1.6.7",
"dayjs": "^1.11.10",
"ethereumjs-util": "^7.1.5",
"framer-motion": "^11.0.23",
"js-big-decimal": "^2.0.7",
"notistack": "^3.0.1",
Expand Down
Loading

0 comments on commit 93eb8e4

Please sign in to comment.