-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (22 loc) · 1018 Bytes
/
Copy pathDockerfile
File metadata and controls
31 lines (22 loc) · 1018 Bytes
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
ARG BASE_IMAGE=cr.loongnix.cn/library/python:3.11.9-slim-buster
FROM ${BASE_IMAGE}
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1
WORKDIR /opt/qilin
COPY backend/requirements.txt /tmp/requirements.txt
# LoongArch 上部分 Python 包需要本机编译,完成后移除构建工具减小镜像。
ARG PIP_INDEX_URL=https://pypi.org/simple
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential \
&& python -m pip install --no-cache-dir --index-url "${PIP_INDEX_URL}" -r /tmp/requirements.txt \
&& apt-get purge -y --auto-remove build-essential \
&& rm -rf /var/lib/apt/lists/* /tmp/requirements.txt
COPY backend ./backend
COPY frontend ./frontend
COPY run.py ./run.py
RUN mkdir -p /opt/qilin/var
EXPOSE 8000
HEALTHCHECK --interval=20s --timeout=5s --start-period=40s --retries=5 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/', timeout=3)" || exit 1
CMD ["python", "run.py"]