docker暴露一些目录

This commit is contained in:
John Smith 2020-09-05 08:45:19 +08:00
parent ca55f9917d
commit 626099f835
3 changed files with 20 additions and 9 deletions

View File

@ -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/*

View File

@ -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"]

View File

@ -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),以下略