Skip to content

Commit 3635192

Browse files
committed
fix(pack-images): gdal not found
1 parent f1eb763 commit 3635192

11 files changed

Lines changed: 34 additions & 16 deletions

File tree

Dockerfile.run

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ ENV DRYCC_UID=1001 \
99

1010
RUN groupadd drycc --gid ${DRYCC_GID} \
1111
&& useradd drycc -u ${DRYCC_UID} -g ${DRYCC_GID} -s /bin/bash -m -d ${DRYCC_HOME_DIR} \
12-
&& chown ${DRYCC_GID}:${DRYCC_UID} /opt
12+
&& chown ${DRYCC_GID}:${DRYCC_UID} /opt /etc/ld.so.conf.d \
13+
&& install-packages sudo \
14+
&& echo "drycc ALL=(root) NOPASSWD:/usr/sbin/ldconfig" > /etc/sudoers.d/drycc
1315

1416
USER ${DRYCC_UID}
1517
# Pack style, `=` cannot be used

buildpacks/go/bin/build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ echo "---> Go Buildpack"
77
layers_dir=$1
88
plan_path=$3
99

10-
rm -rf /opt/drycc; ln -s "${layers_dir}" /opt/drycc
1110
# shellcheck source=/dev/null
1211
. generate-layers.sh "${layers_dir}"
1312
generate_deps_layer build-deps

buildpacks/java/bin/build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ shopt -s expand_aliases
55
layers_dir=$1
66
plan_path=$3
77

8-
rm -rf /opt/drycc; ln -s "${layers_dir}" /opt/drycc
98
# shellcheck source=/dev/null
109
. generate-layers.sh "${layers_dir}"
1110
generate_deps_layer build-deps

buildpacks/node/bin/build

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ echo "---> Node Buildpack"
77
layers_dir=$1
88
plan_path=$3
99

10-
rm -rf /opt/drycc; ln -s "${layers_dir}" /opt/drycc
11-
1210
# 2. Install build deps
1311
# shellcheck source=/dev/null
1412
. generate-layers.sh "${layers_dir}"

buildpacks/php/bin/build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ bp_dir=$(
1414
cd "$(dirname "$0")"/..
1515
pwd
1616
)
17-
rm -rf /opt/drycc; ln -s "${layers_dir}" /opt/drycc
1817

1918
# 2. Install build deps
2019
# shellcheck source=/dev/null

buildpacks/python/bin/build

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ echo "---> Python Buildpack"
77
layers_dir=$1
88
plan_path=$3
99

10-
rm -rf /opt/drycc; ln -s "${layers_dir}" /opt/drycc
11-
1210
# 2. Install build deps
1311
# shellcheck source=/dev/null
1412
. generate-layers.sh "${layers_dir}"

buildpacks/ruby/bin/build

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ echo "---> Ruby Buildpack"
66
layers_dir=$1
77
plan_path=$3
88

9-
rm -rf /opt/drycc; ln -s "${layers_dir}" /opt/drycc
10-
119
# 2. Install build deps
1210
# shellcheck source=/dev/null
1311
. generate-layers.sh "${layers_dir}"

buildpacks/rust/bin/build

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ echo "---> Rust Buildpack"
77
layers_dir=$1
88
plan_path=$3
99

10-
rm -rf /opt/drycc; ln -s "${layers_dir}" /opt/drycc
11-
1210
# 2. Install build deps
1311
# shellcheck source=/dev/null
1412
. generate-layers.sh "${layers_dir}"

rootfs/usr/local/bin/apt-utils.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,18 @@ apt-install() {
3333
if [[ ! -f "${DEB_FILE}" ]] ; then
3434
curl -fsSL -o "${DEB_FILE}" "${DEB_URL}"
3535
fi
36+
dpkg -e "${DEB_FILE}" "$APT_INSTALL_DIR"/DEBIAN
37+
if [[ -f "$APT_INSTALL_DIR"/DEBIAN/preinst ]] ; then
38+
sed -i "s#/usr/lib/#$APT_INSTALL_DIR/usr/lib/#g" "$APT_INSTALL_DIR"/DEBIAN/preinst
39+
"$APT_INSTALL_DIR"/DEBIAN/preinst install 2>/dev/null || echo "skip exec ${DEB_FILE} postinst"
40+
fi
3641
dpkg -x "${DEB_FILE}" "$APT_INSTALL_DIR"
42+
if [[ -f "$APT_INSTALL_DIR"/DEBIAN/postinst ]] ; then
43+
sed -i "s#/usr/lib/#$APT_INSTALL_DIR/usr/lib/#g" "$APT_INSTALL_DIR"/DEBIAN/postinst
44+
"$APT_INSTALL_DIR"/DEBIAN/postinst configure 2>/dev/null || echo "skip exec ${DEB_FILE} postinst"
45+
fi
46+
rm -rf "$APT_INSTALL_DIR"/DEBIAN
47+
3748
pkgconfig_list=$(find "$APT_INSTALL_DIR"/usr/lib/*-linux-gnu/pkgconfig/*.pc 2>/dev/null || echo "")
3849
for pkgconfig in ${pkgconfig_list}
3950
do

rootfs/usr/local/bin/generate-layers.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,21 @@ _install_deps() {
1616

1717
_create_deps_profile() {
1818
local deps_layer_dir="$1"
19-
mkdir -p "${deps_layer_dir}/profile.d"
19+
mkdir -p "${deps_layer_dir}"/profile.d
20+
mkdir -p "${deps_layer_dir}"/etc/ld.so.conf.d
2021
cat > "${deps_layer_dir}/profile.d/deps.sh" <<EOL
2122
export PATH="${deps_layer_dir}/usr/bin:${deps_layer_dir}/bin:\${PATH}"
2223
export C_INCLUDE_PATH="${deps_layer_dir}/usr/include:\${C_INCLUDE_PATH}"
2324
export CPLUS_INCLUDE_PATH="${deps_layer_dir}/usr/include:\${CPLUS_INCLUDE_PATH}"
24-
export LIBRARY_PATH="${deps_layer_dir}/lib:${deps_layer_dir}/lib/$(uname -m)-linux-gnu:${deps_layer_dir}/usr/lib:${deps_layer_dir}/usr/lib/$(uname -m)-linux-gnu:\${LIBRARY_PATH}"
25-
export LD_LIBRARY_PATH="${deps_layer_dir}/lib:${deps_layer_dir}/lib/$(uname -m)-linux-gnu:${deps_layer_dir}/usr/lib:${deps_layer_dir}/usr/lib/$(uname -m)-linux-gnu:\${LD_LIBRARY_PATH}"
2625
export PKG_CONFIG_PATH="${deps_layer_dir}/lib/$(uname -m)-linux-gnu/pkg-config:${deps_layer_dir}/usr/lib/$(uname -m)-linux-gnu/pkg-config:\${PKG_CONFIG_PATH}"
2726
EOL
27+
cat > "${deps_layer_dir}/etc/ld.so.conf.d/deps.conf" <<EOL
28+
${deps_layer_dir}/lib
29+
${deps_layer_dir}/lib/$(uname -m)-linux-gnu
30+
${deps_layer_dir}/usr/lib
31+
${deps_layer_dir}/usr/lib/$(uname -m)-linux-gnu
32+
EOL
33+
sudo ldconfig
2834
}
2935

3036
_create_deps_metadata() {
@@ -48,10 +54,13 @@ EOL
4854
generate_base_layer() {
4955
base_layer="${layers_dir}"/base
5056
mkdir -p "${base_layer}/profile.d"
51-
cat > "${base_layer}/profile.d/base.sh" <<EOL
57+
cat > "${base_layer}/profile.d/link.sh" <<EOL
5258
rm -rf /opt/drycc
5359
ln -s "${layers_dir}" /opt/drycc
60+
echo "include ${layers_dir}/*/etc/ld.so.conf.d/*.conf" > /etc/ld.so.conf.d/drycc.conf
61+
sudo ldconfig
5462
EOL
63+
bash "${base_layer}/profile.d/link.sh"
5564
cat > "${base_layer}.toml" <<EOL
5665
[types]
5766
cache = true

0 commit comments

Comments
 (0)