Skip to content

Commit

Permalink
改进Docker的使用方式 (DIYgod#272)
Browse files Browse the repository at this point in the history
* 改进Docker的使用方式(DIYgod#271)

* ignore npm lockfile, config dir desc file

* Accept with the advice of the maintainer
  • Loading branch information
soulteary authored and DIYgod committed Jun 6, 2018
1 parent e7065ea commit 4663a6e
Show file tree
Hide file tree
Showing 6 changed files with 13,296 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ error.log
combined.log
.vscode
docs/.vuepress/dist

config/app.json
config/config.js
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
package.json
docs/.vuepress/dist
package-lock.json
18 changes: 12 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
FROM keymetrics/pm2:8-alpine
FROM node:10.3.0-slim

MAINTAINER soulteary<[email protected]>

ENV NODE_ENV production

WORKDIR /usr/src/app
COPY ["package.json", "./"]
RUN yarn --ignore-engines --prod -s && mv node_modules ../
COPY . .
EXPOSE 1200
CMD pm2-runtime start process.json

ADD ./package.json .

ARG USE_CHINA_NPM_REGISTRY=0
RUN if [ "$USE_CHINA_NPM_REGISTRY" = 1 ]; then echo 'use npm mirror'; npm install --production --vb --registry=https://registry.npm.taobao.org; else npm install --production; fi;

ADD . .
Empty file added config/.gitkeep
Empty file.
24 changes: 18 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,35 @@
version: '2.1'

services:

rsshub:
build:
dockerfile: ./Dockerfile
context: .
args:
# 是否在构建过程中使用淘宝NPM源进行加速
USE_CHINA_NPM_REGISTRY: 0
restart: always
image: rsshub
container_name: rsshub
build: .
ports:
- 1200:1200
environment:
NODE_ENV: production
CACHE_TYPE: redis
REDIS_URL: 'redis://redis:6379/'
ports:
- 1200:1200
command: node index.js
links:
- redis
volumes:
- ./config/app.json:/usr/src/app/app.json
- ./config/config.js:/usr/src/app/config.json
depends_on:
- redis

redis:
image: redis:alpine
image: redis:4.0.9-alpine
volumes:
- redis-data:/data
- redis-data:/data

volumes:
redis-data:
Loading

0 comments on commit 4663a6e

Please sign in to comment.