DockerRobot/python3.10/Dockerfile

53 lines
1.6 KiB
Docker

FROM python:3.10
# image info
LABEL Project="Python3.10_debian11"
LABEL Author="lzwang"
LABEL Email="zhuangwang82@gmail.com"
LABEL Version="nightly"
# setup volume
VOLUME /project
# setup workdir
WORKDIR /project
# upgrade pip
RUN pip install --no-cache-dir --upgrade pip \
&& rm -rf /root/.cache \
&& rm -rf /tmp/*
# setup timezone
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& date
# update apt packages
RUN apt-get update -y && apt-get upgrade -y \
&& apt-get install apt-utils -y \
&& rm -rf /var/lib/apt/lists/*
# python pip install dependencies
COPY ./python3.10/requirements.txt /project/requirements.txt
# install pip packages
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt \
&& rm -rf /root/.cache \
&& rm -rf /tmp/*
# setup alias
RUN echo "alias ll='ls -la'" >> /root/.bashrc
# setup mirrors of apt
# https://mirrors.tuna.tsinghua.edu.cn/help/debian/
RUN echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free" > /etc/apt/sources.list \
&& echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free" >> /etc/apt/sources.list \
&& echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free" >> /etc/apt/sources.list \
&& echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free" >> /etc/apt/sources.list
# setup mirrors of pip
# https://mirrors.tuna.tsinghua.edu.cn/help/pypi/
RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
CMD ["python3"]