[ 公司dockerfile ]


文件内容

# Install apt packages
# RUN apt-get update && apt-get install --no-install-recommends -y \
#   # dependencies for building Python packages
#   build-essential \
#   # psycopg2 dependencies
#   libpq-dev 

# # Requirements are installed here to ensure they will be cached.
# COPY ./requirements .

# # Create Python Dependency and Sub-Dependency Wheels.
# RUN pip wheel --wheel-dir /usr/src/app/wheels  \
#   -r ${BUILD_ENVIRONMENT}.txt

替换成

RUN  sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list 
RUN  sed -i s@/deb.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list 
RUN  apt-get clean

RUN apt-get update
# Install apt packages
# RUN apt-get update && apt-get install --no-install-recommends -y \
  # dependencies for building Python packages
RUN apt install --no-install-recommends -y build-essential libpq-dev

  # psycopg2 dependencies

# Requirements are installed here to ensure they will be cached.
COPY ./requirements .

RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && \
  pip config set install.trusted-host mirrors.aliyun.com 
# Create Python Dependency and Sub-Dependency Wheels.
RUN pip wheel --wheel-dir /usr/src/app/wheels  \
  -r ${BUILD_ENVIRONMENT}.txt