-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
28 lines (22 loc) · 967 Bytes
/
Dockerfile
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
FROM python:3.10-slim
# 设置工作目录
WORKDIR /app
# 设置环境变量
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# 设置国内源
RUN rm -rf /etc/apt/sources.list.d/* && \
echo "deb http://mirrors.aliyun.com/debian bookworm main contrib non-free" > /etc/apt/sources.list && \
echo "deb http://mirrors.aliyun.com/debian bookworm-updates main contrib non-free" >> /etc/apt/sources.list && \
echo "deb http://mirrors.aliyun.com/debian-security bookworm-security main contrib non-free" >> /etc/apt/sources.list
# 安装系统依赖
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
pkg-config \
default-libmysqlclient-dev \
default-mysql-client && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# 将当前目录下的内容复制到容器的工作目录内
COPY . /app/
# 安装项目所需的依赖
RUN pip install -i https://mirrors.aliyun.com/pypi/simple/ -r requirements.txt