FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
QuantDinger--/backend_api_python/Dockerfile at feture2 · litter998/QuantDinger-- · GitHub
litter998
/
QuantDinger--
Public
forked from
OpenByteInc/QuantDinger
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
QuantDinger--
/
backend_api_python
/
Dockerfile
Copy path
More file actions
More file actions
Latest commit
History
History
History
81 lines (69 loc) · 3.09 KB
Breadcrumbs
QuantDinger--
/
backend_api_python
/
Dockerfile
Copy path
File metadata and controls
81 lines (69 loc) · 3.09 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#
QuantDinger Backend API Dockerfile
#
BASE_IMAGE can be overridden from docker-compose (e.g. IMAGE_PREFIX for mirror pulls).
ARG
BASE_IMAGE=python:3.12-slim-bookworm
FROM
${BASE_IMAGE}
#
BUILD_REGION switches apt/PyPI sources:
#
global -> use Debian/PyPI official directly, skip Aliyun entirely (default)
#
cn -> Aliyun mirrors first, fall back to official on failure
ARG
BUILD_REGION=global
ARG
APP_VERSION=
""
ARG
GIT_TAG=
""
WORKDIR
/app
#
Apt: when BUILD_REGION=cn, try Aliyun Debian mirror first (typical win in mainland) and
#
restore official on failure. Otherwise go straight to official sources so overseas
#
builders (e.g. GitHub-hosted runners) don't waste time hitting cn mirrors.
RUN
set -eux; \
APT_TIMEOUT=
'Acquire::http::Timeout=35'
; \
if [
"$BUILD_REGION"
=
"cn"
]; then \
if [ -f /etc/apt/sources.list.d/debian.sources ]; then \
cp /etc/apt/sources.list.d/debian.sources /tmp/debian.sources.bak; \
sed -i -E \
's|https?://deb.debian.org|https://mirrors.aliyun.com|g; s|https?://security.debian.org|https://mirrors.aliyun.com|g'
\
/etc/apt/sources.list.d/debian.sources; \
if ! apt-get -o
"$APT_TIMEOUT"
-o Acquire::https::Timeout=35 update; then \
cp /tmp/debian.sources.bak /etc/apt/sources.list.d/debian.sources; \
sed -i
's|http://deb.debian.org|https://deb.debian.org|g'
/etc/apt/sources.list.d/*.sources 2>/dev/null || true; \
apt-get -o
"$APT_TIMEOUT"
update; \
fi; \
else \
sed -i
's|http://deb.debian.org|https://deb.debian.org|g'
/etc/apt/sources.list.d/*.sources 2>/dev/null || true; \
apt-get -o
"$APT_TIMEOUT"
update; \
fi; \
else \
apt-get -o
"$APT_TIMEOUT"
update; \
fi; \
apt-get install -y --no-install-recommends --fix-missing \
ca-certificates \
curl \
build-essential \
python3-dev \
libffi-dev \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
COPY
requirements.txt .
#
Pip: when BUILD_REGION=cn, try Aliyun PyPI first; on any failure retry default index.
#
Otherwise install from PyPI official directly.
RUN
set -eux; \
if [
"$BUILD_REGION"
=
"cn"
]; then \
pip install --no-cache-dir --prefer-binary --timeout 180 \
-i https://mirrors.aliyun.com/pypi/simple/ \
-r requirements.txt \
|| pip install --no-cache-dir --prefer-binary --timeout 180 -r requirements.txt; \
else \
pip install --no-cache-dir --prefer-binary --timeout 180 -r requirements.txt; \
fi; \
apt-get purge -y --auto-remove build-essential python3-dev libffi-dev libssl-dev; \
rm -rf /var/lib/apt/lists/*
COPY
. .
RUN
printf
'%s
\n
'
"$APP_VERSION"
> /app/BUILD_VERSION \
&& printf
'%s
\n
'
"$GIT_TAG"
> /app/BUILD_GIT_TAG
COPY
docker-entrypoint.sh /usr/local/bin/
RUN
sed -i
's/
\r
$//'
/usr/local/bin/docker-entrypoint.sh \
&& chmod +x /usr/local/bin/docker-entrypoint.sh
RUN
mkdir -p logs data/memory
EXPOSE
5000
ENV
PYTHONUNBUFFERED=1
ENV
PYTHON_API_HOST=0.0.0.0
ENV
PYTHON_API_PORT=5000
ENTRYPOINT
[
"/usr/local/bin/docker-entrypoint.sh"
]
CMD
[
"gunicorn"
,
"-c"
,
"gunicorn_config.py"
,
"run:app"
]
Back
|
FazBrowse Home
|
New Git URL