-
Notifications
You must be signed in to change notification settings - Fork 14
/
generate-dockerfiles.sh
executable file
·23 lines (19 loc) · 1.31 KB
/
generate-dockerfiles.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env bash
declare -a DEBIAN_VERSIONS=(buster bullseye)
for debian_version in "${DEBIAN_VERSIONS[@]}"; do
cat <<EOF > Dockerfile.${debian_version}
# This file was automatically generated by generate-dockerfiles.sh
# Do not edit this file directly.
# Instead, edit Dockerfile.tmpl or generate-dockerfiles.sh, then run ./generate-dockerfiles.sh
EOF
cat Dockerfile.tmpl >> Dockerfile.${debian_version}
sed -i "s/\${DEBIAN_VERSION}/${debian_version}/g" Dockerfile.${debian_version}
done
# For Buster, we need python3-grpcio and python3-setuptools for Python dependencies and libjson-c3 for ttyd
sed -i "s/<VERSION_SPECIFIC_DEPENDENCIES>/python3-grpcio python3-setuptools libjson-c3/g" Dockerfile.buster
# For Bullseye, we need libjson-c5 instead of libjson-c3
sed -i "s/<VERSION_SPECIFIC_DEPENDENCIES>/libjson-c5/" Dockerfile.bullseye
# For Buster we need a special filter to prevent pip from installing grpc, because it would compile it from scratch and that would take too long
sed -i "s/<INSTALL_MAYBE_NO_GRPC>/cat requirements.txt | grep -v grpcio > requirements-nogrpcio.txt \&\& pip3 install -r requirements-nogrpcio.txt/g" Dockerfile.buster
# On Bullseye, pip is able to find a prebuilt wheel, so we don't need this filter
sed -i "s/<INSTALL_MAYBE_NO_GRPC>/pip3 install -r requirements.txt/g" Dockerfile.bullseye