Skip to content

Commit

Permalink
feat(crawler): dockerize service
Browse files Browse the repository at this point in the history
  • Loading branch information
njfamirm authored Nov 26, 2022
1 parent 2b80ccd commit e6303c3
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 2 deletions.
15 changes: 13 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
PORT=80
TELEGRAM_BOT_TOKEN=
API_TOKEN='YOUR_SECRET_TOKEN'

# storage
STORAGE_TOKEN='YOUR_SECRET_TOKEN'
STORAGE_NAME='job'
STORAGE_PORT='9000'
STORAGE_HOST='127.0.0.1'

# api
API_TOKEN='YOUR_SECRET_TOKEN'

# crawler
NOTIFIER_HOST='http://127.0.0.1:8001'
NOTIFIER_TO='all'
NOTIFIER_TOKEN='YOUR_SECRET_TOKEN'

# telegram-notifier
TELEGRAM_BOT_TOKEN=
21 changes: 21 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,27 @@ services:
max-size: '10m'
max-file: '2'

crawler:
build:
context: ./crawler

restart: "no"

stop_grace_period: 30s

cpu_shares: 2048
# mem_limit: 256m

env_file: .env

tty: true

logging:
driver: json-file
options:
max-size: '10m'
max-file: '2'

telegram-notifier:
build:
context: ./telegram-notifier
Expand Down
24 changes: 24 additions & 0 deletions crawler/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
ARG NODE_VERSION=18

FROM node:${NODE_VERSION}-alpine

WORKDIR /app

COPY package.json ./

RUN yarn install --frozen-lockfile --non-interactive

COPY . .
RUN yarn build

ENV PORT 80
ENV TOKEN ${API_TOKEN}
ENV STORAGE_NAME ${STORAGE_NAME}
ENV STORAGE_HOST ${STORAGE_HOST}
ENV STORAGE_PORT ${STORAGE_PORT}
ENV STORAGE_TOKEN ${STORAGE_TOKEN}
ENV NODE_ENV production

EXPOSE 80

CMD ["dist/index.js"]

0 comments on commit e6303c3

Please sign in to comment.