b24a61cb by 柴进

apt pip均走国内镜像

1 parent 2fe5f710
Showing 1 changed file with 22 additions and 12 deletions
1 # Use Python 3.9 slim image 1 # Use Python 3.9 slim image
2 FROM python:3.9-slim 2 FROM registry.cn-shanghai.aliyuncs.com/zb100registry/python:3.9-slim
3 3
4 # Set working directory 4 # Set working directory
5 WORKDIR /app 5 WORKDIR /app
6 6
7 # Install system dependencies 7 # Install system dependencies
8 RUN apt-get update && apt-get install -y \ 8 # Install system dependencies (use Aliyun apt mirror)
9 gcc \ 9 RUN set -eux; \
10 g++ \ 10 if [ -f /etc/apt/sources.list ]; then \
11 libgl1 \ 11 sed -i 's|deb.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list; \
12 libglib2.0-0 \ 12 sed -i 's|security.debian.org|mirrors.aliyun.com/debian-security|g' /etc/apt/sources.list; \
13 libsm6 \ 13 elif [ -f /etc/apt/sources.list.d/debian.sources ]; then \
14 libxext6 \ 14 sed -i 's|deb.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list.d/debian.sources; \
15 libxrender-dev \ 15 sed -i 's|security.debian.org|mirrors.aliyun.com/debian-security|g' /etc/apt/sources.list.d/debian.sources; \
16 libgomp1 \ 16 fi; \
17 curl \ 17 apt-get update; \
18 && rm -rf /var/lib/apt/lists/* 18 apt-get install -y --no-install-recommends \
19 gcc \
20 g++ \
21 libgl1 \
22 libglib2.0-0 \
23 libsm6 \
24 libxext6 \
25 libxrender-dev \
26 libgomp1 \
27 curl; \
28 rm -rf /var/lib/apt/lists/*
19 29
20 # Copy requirements first for better caching 30 # Copy requirements first for better caching
21 COPY requirements-docker.txt . 31 COPY requirements-docker.txt .
......