You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.2 KiB
Docker
48 lines
1.2 KiB
Docker
FROM python:3.12-slim AS runtime
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PIP_NO_CACHE_DIR=1 \
|
|
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
|
PIP_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/ \
|
|
PIP_TRUSTED_HOST=mirrors.aliyun.com \
|
|
PIP_DEFAULT_TIMEOUT=120 \
|
|
PIP_RETRIES=5 \
|
|
ENVIRONMENT=prod \
|
|
TZ=Asia/Shanghai
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends \
|
|
curl \
|
|
fontconfig \
|
|
fonts-dejavu-core \
|
|
libcairo2 \
|
|
libgdk-pixbuf-2.0-0 \
|
|
libpango-1.0-0 \
|
|
libpangocairo-1.0-0 \
|
|
shared-mime-info \
|
|
tzdata \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY requirements.txt ./
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
COPY alembic.ini main.py banner.txt ./
|
|
COPY alembic ./alembic
|
|
COPY app ./app
|
|
COPY env ./env
|
|
COPY static ./static
|
|
COPY templates ./templates
|
|
|
|
RUN mkdir -p logs static/upload static/download static/invoice
|
|
|
|
EXPOSE 8011
|
|
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
|
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8001/common/health', timeout=5)" || exit 1
|
|
|
|
CMD ["python", "main.py", "run", "--env=prod"]
|