REMOVE LDAP
This commit is contained in:
49
Dockerfile
Normal file
49
Dockerfile
Normal file
@@ -0,0 +1,49 @@
|
||||
# 使用官方 Python 3.10 運行時作為基礎映像
|
||||
# 可通過 build args 覆蓋,例如: --build-arg PY_BASE=python:3.10-slim
|
||||
ARG PY_BASE=python:3.10-slim
|
||||
FROM ${PY_BASE}
|
||||
|
||||
# 設定環境變數
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# 設定工作目錄
|
||||
WORKDIR /app
|
||||
|
||||
# 更新系統套件並安裝必要的系統依賴
|
||||
RUN apt-get update && apt-get install -y \
|
||||
gcc \
|
||||
default-libmysqlclient-dev \
|
||||
pkg-config \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 複製依賴檔案
|
||||
COPY requirements.txt .
|
||||
|
||||
# 安裝 Python 依賴
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# 複製應用程式代碼
|
||||
COPY . .
|
||||
|
||||
# 建立必要的目錄
|
||||
RUN mkdir -p uploads static/generated logs
|
||||
|
||||
# 設定權限
|
||||
RUN chmod +x app.py
|
||||
|
||||
# 暴露端口
|
||||
EXPOSE 5000
|
||||
|
||||
# 健康檢查
|
||||
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
||||
CMD curl -f http://localhost:5000/ || exit 1
|
||||
|
||||
# 複製生產配置文件
|
||||
COPY gunicorn.conf.py wsgi.py ./
|
||||
|
||||
# 啟動命令 - 使用 Gunicorn
|
||||
CMD ["gunicorn", "-c", "gunicorn.conf.py", "wsgi:app"]
|
||||
|
Reference in New Issue
Block a user