Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: dockerize app #33

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
build
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
BLOCK_IO_API_KEY=XXXXXXXXXXXXX
BLOCK_IO_SECRET_PIN=XXXXXXXXXXXXX
SLACK_TOKEN=XXXXXXXXXXXXX
BOT_USER_ID=XXXXXXXXXXXXX
BOT_CHANNEL_MEMBER_ID=XXXXXXXXXXXXX
GENERAL_CHANNEL_ID=XXXXXXXXXXXXX
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ node_modules
.env
.idea/
yarn-error.log
*.env
build
15 changes: 8 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
FROM node:8-alpine

FROM node:12-alpine
WORKDIR /opt/app
COPY . /opt/app

RUN npm i
RUN npm i -g forever
COPY ./ /opt/app/
RUN yarn && yarn build

ENTRYPOINT sh /opt/app/app.sh
FROM node:12-alpine
WORKDIR /opt/app
COPY --from=0 /opt/app/build /opt/app/
RUN yarn --production && yarn cache clean
CMD ["node", "index.js"]
5 changes: 5 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM node:12-alpine
WORKDIR /opt/app
RUN yarn

CMD ["yarn", "dev"]
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,22 @@

`.env` file should look like:

```
```shell
BLOCK_IO_API_KEY=XXXXXXXXX
BLOCK_IO_SECRET_PIN=XXXXXXX
SLACK_TOKEN=xoxb-.....
BOT_USER_ID=-----
GENERAL_CHANNEL_ID=YOUR_GENERAL_CHANNEL
```

`dev.env` should look like this:

```shell
NGROK_ACCOUNT=YOURNAME-bitwaladev
HOST=doge-cool
PORT=3000
```

### In public / private channels

- `tip <username> <amount>` - gives amount to specified user
Expand All @@ -23,3 +31,12 @@ GENERAL_CHANNEL_ID=YOUR_GENERAL_CHANNEL
- `deposit` - return address
- `balance` - shows balance
- `withdraw <adress> <amount?>` - withdraws to address

## Docker

- develop app in container:
`yarn dev:docker`
- build image:
`yarn build:docker`
- run app in container:
`yarn start:docker`
5 changes: 0 additions & 5 deletions app.sh

This file was deleted.

2 changes: 2 additions & 0 deletions dev.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
NGROK_ACCOUNT=XXXXXXXXXXXXX
HOST=XXXXXXXXXXXXX
19 changes: 19 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: "3"
services:
doge-cool:
build:
context: ./
dockerfile: Dockerfile.dev
volumes:
- ./:/opt/app
ngrok:
image: wernight/ngrok
command: ./start-ngrok.sh
env_file:
- ./.env
- ./dev.env
volumes:
- $HOME/.ngrok2/:/home/ngrok/.ngrok2/
- ./start-ngrok.sh:/start-ngrok.sh
depends_on:
- doge-cool
12 changes: 12 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: "3"
services:
doge-cool:
image: doge-cool:latest
ports:
- 3000:3000
restart: unless-stopped
logging:
driver: "json-file"
options:
max-file: "10"
max-size: "100m"
Loading