-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (36 loc) · 1.27 KB
/
Dockerfile
File metadata and controls
48 lines (36 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# 使用官方 Python 3.12 精简版镜像作为基础镜像
FROM python:3.12-slim
# 设置工作目录
WORKDIR /app
# 创建配置目录
RUN mkdir -p /app/data
# 声明挂载点
VOLUME ["/app/data"]
# 设置环境变量
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
# 安装系统依赖
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
supervisor \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /var/log/supervisor
# 创建 supervisor 配置目录
RUN mkdir -p /etc/supervisor/conf.d
# 复制项目文件
COPY . .
# 复制 supervisor 配置文件
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# 安装项目依赖
RUN pip install -e .
# 使用 supervisor 作为入口点
CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
# 健康检查
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD supervisorctl status ibkr_event_daemon | grep RUNNING || exit 1
# 添加标签
LABEL maintainer="Shawn Deng <shawndeng1109@qq.com>" \
description="IBKR Event Daemon with FX Bar Handler support" \
usage.volume="挂载数据目录:docker run -v /path/to/data:/app/data ..." \
usage.env="环境变量配置:docker run -e VARIABLE=value ..."