New Database
This commit is contained in:
+9
-5
@@ -1,14 +1,13 @@
|
||||
FROM python:3.11-slim
|
||||
|
||||
# System dependencies
|
||||
# System dependencies (mirrors.aliyun.com for CN networks)
|
||||
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources && \
|
||||
apt-get update && apt-get install -y --no-install-recommends \
|
||||
git \
|
||||
libgomp1 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Clone project
|
||||
RUN git clone https://gitee.com/zhe-ovo/iot-dboard.git /app
|
||||
# 复制项目代码(含 .git,供 compose 的 app_code 卷内 git pull 更新工作流使用)
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
|
||||
# Install Python dependencies
|
||||
@@ -16,4 +15,9 @@ RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
EXPOSE 5000
|
||||
|
||||
CMD ["python", "start.py"]
|
||||
# Gunicorn:2 个 worker 对应 2 逻辑核心(1 物理核心),线程模式;
|
||||
# 2G 内存/2 CPU 限制由 docker-compose.yml 的 deploy.resources 配置。
|
||||
# 后台调度器通过 PostgreSQL advisory lock 保证只在其中一个 worker 内运行。
|
||||
CMD gunicorn --workers ${GUNICORN_WORKERS:-2} --threads ${GUNICORN_THREADS:-8} \
|
||||
--bind 0.0.0.0:5000 --timeout 120 \
|
||||
--access-logfile - --error-logfile - start:app
|
||||
|
||||
Reference in New Issue
Block a user