forked from mxx1111/Homelab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (31 loc) · 1.3 KB
/
Copy pathDockerfile
File metadata and controls
38 lines (31 loc) · 1.3 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
FROM python:3.11-slim
# 容器内必须换国内 apt 源。用官方 deb.debian.org 构建曾耗时 757 秒后超时失败,
# 换中科大源后降到几十秒。境外机器可以删掉这两行换回官方源。
# Debian 12 用 deb822 格式的 debian.sources,旧格式 sources.list 一并兼容。
RUN set -eux; \
for f in /etc/apt/sources.list.d/debian.sources /etc/apt/sources.list; do \
[ -f "$f" ] && sed -i 's|deb.debian.org|mirrors.ustc.edu.cn|g; s|security.debian.org|mirrors.ustc.edu.cn|g' "$f" || true; \
done; \
apt-get update; \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
btrfs-progs \
openssl \
openssh-client \
ca-certificates \
smartmontools \
util-linux; \
rm -rf /var/lib/apt/lists/*
# docker CLI 不在镜像内安装,由 compose 从宿主机挂载 /usr/bin/docker。
# 宿主机与本镜像同为 Debian 12,libc 版本一致,可直接运行。
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt \
-i https://mirrors.ustc.edu.cn/pypi/simple \
--trusted-host mirrors.ustc.edu.cn
COPY backend ./backend
COPY frontend ./frontend
COPY run.py .
ENV PYTHONUNBUFFERED=1 \
HOMELAB_CONFIG=/app/config.yaml
EXPOSE 8770
CMD ["python", "run.py"]