Skip to content

Commit

Permalink
docker暴露一些目录
Browse files Browse the repository at this point in the history
  • Loading branch information
xfgryujk committed Sep 5, 2020
1 parent ca55f99 commit 626099f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
7 changes: 6 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@ build/
**/node_modules/

# IDEs and editors
/.idea
.idea/

# misc
**/.git*
*.spec
screenshots/
README.md

# runtime data
data/*
!data/config.ini
log/*
16 changes: 9 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,22 @@ RUN wget https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-x64.tar.xz \
&& ln -s /node-v10.16.0-linux-x64/bin/npm /usr/local/bin/npm

# 后端依赖
COPY requirements.txt /blivechat/
RUN pip3 install --no-cache-dir -i https://pypi.tuna.tsinghua.edu.cn/simple -r /blivechat/requirements.txt
WORKDIR /blivechat
COPY requirements.txt ./
RUN pip3 install --no-cache-dir -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt

# 前端依赖
WORKDIR /blivechat/frontend
COPY frontend/package*.json ./
WORKDIR ./frontend
COPY frontend/package.json frontend/package-lock.json ./
RUN npm i --registry=https://registry.npm.taobao.org

# 编译
COPY . /blivechat
# 编译前端
COPY . ../
RUN npm run build

# 运行
WORKDIR /blivechat
WORKDIR ..
VOLUME /blivechat/data /blivechat/log /blivechat/frontend/dist
EXPOSE 12450
ENTRYPOINT ["python3", "main.py"]
CMD ["--host", "0.0.0.0", "--port", "12450"]
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@

### 四、Docker(自建服务器)
1. ```sh
docker run -d -p 12450:12450 xfgryujk/blivechat:latest
docker run --name blivechat -d -p 12450:12450 \
--mount source=blc-data,target=/blivechat/data \
--mount source=blc-log,target=/blivechat/log \
--mount source=blc-frontend,target=/blivechat/frontend/dist \
xfgryujk/blivechat:latest
```
2. 用浏览器打开[http://localhost:12450](http://localhost:12450),以下略

Expand Down

0 comments on commit 626099f

Please sign in to comment.