Skip to content

Commit

Permalink
Add default auto-update functions to docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
nihey committed Apr 7, 2019
1 parent ae416db commit 330d20a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM node:10

RUN apt-get update && apt-get -y install cron

WORKDIR /var/www/

COPY package-lock.json package-lock.json
Expand All @@ -8,6 +10,8 @@ RUN npm ci --only=production

COPY . .

RUN crontab ./crons/updater.cron

EXPOSE 7000

CMD [ "npm", "run", "serve-production" ]
CMD cron && npm run serve-production
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
rebuild:
docker-compose build bovespa
docker-compose up -d
docker-compose build
docker-compose up -d --remove-orphans

reload:
docker-compose up -d
Expand Down
1 change: 1 addition & 0 deletions crons/updater.cron
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10 2 * * 1-6 NODE_ENV=production npm run update >> /var/log/updater.log
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ services:
restart: always
bovespa:
build: .
environment:
NODE_ENV: production
ports:
- 7000:7000
depends_on:
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"serve": "fastify start bin/server.js -p 7000 -a 0.0.0.0 -l debug -w",
"serve-production": "NODE_ENV=production fastify start bin/server.js -p 7000 -a 0.0.0.0 -l debug",
"build": "node ./bin/build.js",
"update": "node ./bin/build.js --update",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
Expand Down

0 comments on commit 330d20a

Please sign in to comment.