-
Notifications
You must be signed in to change notification settings - Fork 72
Expand file tree
/
Copy pathDockerfile.base
More file actions
51 lines (44 loc) · 1.83 KB
/
Copy pathDockerfile.base
File metadata and controls
51 lines (44 loc) · 1.83 KB
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
# Base image: Python dependencies only.
# Rebuild only when pyproject.toml or core dependencies change:
# docker build -f Dockerfile.base -t openvort-base:latest .
# docker build -f Dockerfile.base --build-arg MIRROR=cn -t openvort-base:latest . (China)
FROM python:3.11-slim-bookworm
ARG MIRROR=default
RUN if [ "$MIRROR" = "cn" ]; then \
sed -i 's|deb.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list.d/debian.sources; \
fi && \
apt-get update && apt-get install -y --no-install-recommends \
git \
ca-certificates \
curl \
xz-utils \
&& PGDG_MIRROR="http://apt.postgresql.org/pub/repos/apt" \
&& if [ "$MIRROR" = "cn" ]; then \
PGDG_MIRROR="https://mirrors.aliyun.com/postgresql/repos/apt"; \
fi \
&& echo "deb [trusted=yes] $PGDG_MIRROR $(. /etc/os-release && echo $VERSION_CODENAME)-pgdg main" \
> /etc/apt/sources.list.d/pgdg.list \
&& apt-get update && apt-get install -y --no-install-recommends postgresql-client-18 \
&& rm -rf /var/lib/apt/lists/*
RUN if [ "$MIRROR" = "cn" ]; then \
curl -fsSL https://npmmirror.com/mirrors/node/v20.18.0/node-v20.18.0-linux-x64.tar.xz \
| tar -xJ -C /usr/local --strip-components=1; \
else \
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y --no-install-recommends nodejs \
&& rm -rf /var/lib/apt/lists/*; \
fi
WORKDIR /app
COPY pyproject.toml README.md LICENSE ./
COPY src/ src/
COPY alembic/ alembic/
RUN pip install --no-cache-dir --upgrade pip && \
if [ "$MIRROR" = "cn" ]; then \
pip install --no-cache-dir -e . -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com; \
else \
pip install --no-cache-dir -e .; \
fi
ENV PYTHONUNBUFFERED=1
EXPOSE 8090
ENTRYPOINT ["python", "-u", "-m", "openvort"]
CMD ["start"]