2022-03-01 00:57:16 +08:00
|
|
|
#
|
|
|
|
# 构建前端
|
|
|
|
#
|
2019-07-07 23:01:42 +08:00
|
|
|
|
2023-07-29 18:34:02 +08:00
|
|
|
FROM node:18.17.0-bullseye AS builder
|
2022-03-01 00:57:16 +08:00
|
|
|
ARG BASE_PATH='/root/blivechat'
|
|
|
|
WORKDIR "${BASE_PATH}/frontend"
|
2019-07-07 23:01:42 +08:00
|
|
|
|
|
|
|
# 前端依赖
|
2020-11-28 23:50:18 +08:00
|
|
|
COPY frontend/package.json ./
|
2024-07-30 00:16:36 +08:00
|
|
|
RUN npm i --registry=https://registry.npmmirror.com
|
2019-07-07 23:01:42 +08:00
|
|
|
|
2020-09-05 08:45:19 +08:00
|
|
|
# 编译前端
|
2022-03-01 00:57:16 +08:00
|
|
|
COPY frontend ./
|
2019-07-07 23:01:42 +08:00
|
|
|
RUN npm run build
|
|
|
|
|
2022-03-01 00:57:16 +08:00
|
|
|
#
|
|
|
|
# 准备后端
|
|
|
|
#
|
|
|
|
|
2024-11-17 22:55:16 +08:00
|
|
|
FROM python:3.12.7-bookworm
|
2022-03-01 00:57:16 +08:00
|
|
|
ARG BASE_PATH='/root/blivechat'
|
|
|
|
ARG EXT_DATA_PATH='/mnt/data'
|
|
|
|
WORKDIR "${BASE_PATH}"
|
|
|
|
|
|
|
|
# 后端依赖
|
2023-07-29 18:34:02 +08:00
|
|
|
COPY blivedm/requirements.txt blivedm/
|
2022-03-01 00:57:16 +08:00
|
|
|
COPY requirements.txt ./
|
2023-07-29 18:34:02 +08:00
|
|
|
RUN pip3 install --no-cache-dir -i https://mirrors.aliyun.com/pypi/simple -r requirements.txt
|
2022-03-01 00:57:16 +08:00
|
|
|
|
|
|
|
# 数据目录
|
|
|
|
COPY . ./
|
|
|
|
RUN mkdir -p "${EXT_DATA_PATH}/frontend/dist" \
|
|
|
|
&& mv data "${EXT_DATA_PATH}/data" \
|
|
|
|
&& ln -s "${EXT_DATA_PATH}/data" data \
|
|
|
|
&& mv log "${EXT_DATA_PATH}/log" \
|
|
|
|
&& ln -s "${EXT_DATA_PATH}/log" log \
|
|
|
|
&& ln -s "${EXT_DATA_PATH}/frontend/dist" frontend/dist
|
|
|
|
|
|
|
|
# 编译好的前端
|
|
|
|
COPY --from=builder "${BASE_PATH}/frontend/dist" "${EXT_DATA_PATH}/frontend/dist/"
|
|
|
|
|
2019-07-07 23:01:42 +08:00
|
|
|
# 运行
|
2022-03-01 00:57:16 +08:00
|
|
|
VOLUME "${EXT_DATA_PATH}"
|
2019-07-10 15:30:35 +08:00
|
|
|
EXPOSE 12450
|
2019-07-07 23:01:42 +08:00
|
|
|
ENTRYPOINT ["python3", "main.py"]
|
2019-07-10 15:30:35 +08:00
|
|
|
CMD ["--host", "0.0.0.0", "--port", "12450"]
|