Files
ljwx-health/ljwx-bigscreen/bigscreen/Dockerfile.local
T
bruno b24e49e32c feat: 完善前后端集成和类型安全性
🔧 前端优化
- 修复TypeScript类型定义错误
- 完善国际化语言配置
- 优化组件类型声明

🎯 后端功能完善
- 设备信息查询优化
- 健康数据API参数处理改进
- 告警配置微信通知功能完善

📱 多端适配
- 大屏显示Python脚本优化
- 移动端构建配置更新
- Docker多架构支持改进
2025-08-18 23:19:39 +08:00

57 lines
1.4 KiB
Docker

# 本地构建 Dockerfile - 避免网络问题
FROM python:3.9-slim
# 设置工作目录
WORKDIR /app
# 配置pip使用国内源
RUN pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ && \
pip config set install.trusted-host mirrors.aliyun.com && \
pip config set global.timeout 300 && \
pip config set global.retries 3
# 安装系统依赖
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
default-libmysqlclient-dev \
pkg-config \
curl \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
# 复制依赖文件
COPY requirements-docker.txt .
# 安装Python依赖
RUN pip install --upgrade pip && \
pip install --no-cache-dir --timeout=300 --retries=3 wheel setuptools && \
pip install --no-cache-dir --timeout=300 --retries=3 -r requirements-docker.txt
# 创建非root用户
RUN groupadd -r appuser && useradd -r -g appuser appuser
# 复制应用代码并设置权限
COPY . .
RUN chown -R appuser:appuser /app
# 切换到非root用户
USER appuser
# 设置环境变量
ENV MYSQL_HOST=host.docker.internal \
MYSQL_PORT=3306 \
REDIS_HOST=host.docker.internal \
REDIS_PORT=6379 \
PYTHONPATH=/app \
PYTHONUNBUFFERED=1
# 暴露应用端口
EXPOSE 5001
# 健康检查
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:5001/api/health || exit 1
# 启动应用
CMD ["python3", "run.py"]
EOF < /dev/null