fix(Dockerfile): implement fallback mechanisms for apt update and install
This commit is contained in:
42
Dockerfile
42
Dockerfile
@@ -41,8 +41,25 @@ if url:
|
|||||||
finally:
|
finally:
|
||||||
sock.close()
|
sock.close()
|
||||||
PY
|
PY
|
||||||
apt-get update
|
APT_PROXY_CONFIG=/etc/apt/apt.conf.d/01proxy
|
||||||
apt-get install -y --no-install-recommends build-essential gcc libpq-dev
|
|
||||||
|
apt_update_with_fallback() {
|
||||||
|
if ! apt-get update; then
|
||||||
|
rm -f "$APT_PROXY_CONFIG"
|
||||||
|
apt-get update
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
apt_install_with_fallback() {
|
||||||
|
if ! apt-get install -y --no-install-recommends "$@"; then
|
||||||
|
rm -f "$APT_PROXY_CONFIG"
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y --no-install-recommends "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
apt_update_with_fallback
|
||||||
|
apt_install_with_fallback build-essential gcc libpq-dev
|
||||||
pip install --upgrade pip
|
pip install --upgrade pip
|
||||||
pip wheel --no-deps --wheel-dir /wheels -r requirements.txt
|
pip wheel --no-deps --wheel-dir /wheels -r requirements.txt
|
||||||
apt-get purge -y --auto-remove build-essential gcc
|
apt-get purge -y --auto-remove build-essential gcc
|
||||||
@@ -88,8 +105,25 @@ if url:
|
|||||||
finally:
|
finally:
|
||||||
sock.close()
|
sock.close()
|
||||||
PY
|
PY
|
||||||
apt-get update
|
APT_PROXY_CONFIG=/etc/apt/apt.conf.d/01proxy
|
||||||
apt-get install -y --no-install-recommends libpq5
|
|
||||||
|
apt_update_with_fallback() {
|
||||||
|
if ! apt-get update; then
|
||||||
|
rm -f "$APT_PROXY_CONFIG"
|
||||||
|
apt-get update
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
apt_install_with_fallback() {
|
||||||
|
if ! apt-get install -y --no-install-recommends "$@"; then
|
||||||
|
rm -f "$APT_PROXY_CONFIG"
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y --no-install-recommends "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
apt_update_with_fallback
|
||||||
|
apt_install_with_fallback libpq5
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user