Skip to content

Instantly share code, notes, and snippets.

@foxracle
Created October 19, 2023 09:07
Show Gist options
  • Save foxracle/610e9ac1e86ab53fe82667d64ff28d0f to your computer and use it in GitHub Desktop.
Save foxracle/610e9ac1e86ab53fe82667d64ff28d0f to your computer and use it in GitHub Desktop.
python_env_dockerfile
FROM python:3.8.12
WORKDIR /usr/src/app
# set noninteractive
ENV TZ=Asia/Shanghai \
DEBIAN_FRONTEND=noninteractive
# set Asia/Shanghai timezone
RUN ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime \
&& echo ${TZ} > /etc/timezone \
&& dpkg-reconfigure --frontend noninteractive tzdata \
&& rm -rf /var/lib/apt/lists/*
# update source.list
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list
# install zip
RUN apt-get update && apt-get install -y zip && rm -rf /var/lib/apt/lists/*
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple
CMD ["pytest", "-V"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment