asfag654 commited on
Commit
df66c75
·
verified ·
1 Parent(s): ef9f2e2

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +50 -0
Dockerfile ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:latest
2
+ ENV TZ=Asia/Shanghai
3
+ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
4
+ echo $TZ > /etc/timezone
5
+ ENV DEBIAN_FRONTEND=noninteractive
6
+ RUN apt-get update && \
7
+ apt-get install -y -qq git
8
+ WORKDIR /zmal
9
+ RUN git clone --recursive https://github.com/xfgryujk/blivechat.git
10
+ WORKDIR /zmal/blivechat
11
+
12
+ #
13
+ # 构建前端
14
+ #
15
+
16
+ FROM node:18.17.0-bullseye AS builder
17
+ ARG BASE_PATH='/root/blivechat'
18
+ WORKDIR "${BASE_PATH}/frontend"
19
+
20
+ # 前端依赖
21
+ COPY frontend/package.json ./
22
+ RUN npm i
23
+
24
+ # 编译前端
25
+ COPY frontend ./
26
+ RUN npm run build
27
+
28
+ #
29
+ # 准备后端
30
+ #
31
+
32
+ FROM python:3.12.7-bookworm
33
+ ARG BASE_PATH='/zmal/blivechat'
34
+ WORKDIR "${BASE_PATH}"
35
+
36
+ # 后端依赖
37
+ COPY blivedm/requirements.txt blivedm/
38
+ COPY requirements.txt ./
39
+ RUN pip3 install --no-cache-dir -r requirements.txt
40
+
41
+ # 拷贝代码
42
+ COPY . ./
43
+
44
+ # 编译好的前端
45
+ COPY --from=builder "${BASE_PATH}/frontend/dist" frontend/dist/
46
+
47
+ # 运行
48
+ EXPOSE 12450
49
+ ENTRYPOINT ["python3", "main.py"]
50
+ CMD ["--host", "0.0.0.0", "--port", "12450"]