2022-03-05 19:41:45 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
|
2023-07-29 06:36:00 +00:00
|
|
|
source "${ABSDIR}"/../functions.sh
|
|
|
|
source "${ABSDIR}"/vars.sh
|
2022-03-05 19:41:45 +00:00
|
|
|
|
|
|
|
ensure_pwd_is_scriptdir
|
|
|
|
ensure_not_root
|
|
|
|
|
|
|
|
buildfolder=/tmp/seafile-$$
|
|
|
|
|
2023-07-29 07:14:59 +00:00
|
|
|
if ! podman image exists ${seafile_image}:${seafile_release}; then
|
2022-03-05 19:41:45 +00:00
|
|
|
mkdir ${buildfolder} &&
|
2023-07-29 06:36:00 +00:00
|
|
|
if git clone --depth=1 https://github.com/haiwen/seafile-docker.git ${buildfolder}/ ; then
|
2023-07-29 07:14:59 +00:00
|
|
|
sed_in_place "^FROM phusion" "FROM docker.io/phusion" ${buildfolder}/image/seafile_${seafile_release%.*}/Dockerfile &&
|
|
|
|
sed_in_place "SEAFILE_VERSION=" "SEAFILE_VERSION=${seafile_release}" ${buildfolder}/image/seafile_${seafile_release%.*}/Dockerfile &&
|
|
|
|
sed_in_place "pip -i https://pypi.tuna.tsinghua.edu.cn/simple/" "pip" ${buildfolder}/image/seafile_${seafile_release%.*}/Dockerfile &&
|
|
|
|
sed_in_place " -i https://pypi.tuna.tsinghua.edu.cn/simple/" " " ${buildfolder}/image/seafile_${seafile_release%.*}/Dockerfile &&
|
|
|
|
sed_in_place 'wget https://seafile-downloads.oss-cn-shanghai.aliyuncs.com' 'wget -q https://download.seadrive.org' ${buildfolder}/image/seafile_${seafile_release%.*}/Dockerfile &&
|
|
|
|
sed_in_place 'tar -zxvf' 'tar -zxf' ${buildfolder}/image/seafile_${seafile_release%.*}/Dockerfile &&
|
2023-10-29 14:32:34 +00:00
|
|
|
TMPDIR=${HOME} podman image build \
|
2023-10-28 15:41:15 +00:00
|
|
|
-t ${seafile_image}:${seafile_release} \
|
|
|
|
-f ${buildfolder}/image/seafile_${seafile_release%.*}/Dockerfile \
|
|
|
|
${buildfolder} || retval=false
|
|
|
|
podman image prune -a -f --filter dangling=true
|
|
|
|
podman image prune -a -f --filter intermediate=true
|
2023-10-28 15:16:30 +00:00
|
|
|
podman image rm -f $(podman image list -a -q -- phusion/baseimage)
|
2023-07-29 06:36:00 +00:00
|
|
|
fi
|
2022-03-05 19:41:45 +00:00
|
|
|
rm -rf ${buildfolder}
|
2023-07-29 06:36:00 +00:00
|
|
|
eval "$retval"
|
2022-08-14 12:17:34 +00:00
|
|
|
else
|
|
|
|
echo "Image ${seafile_image}:${seafile_release} already built"
|
2023-07-28 21:08:44 +00:00
|
|
|
fi &&
|
2022-08-14 12:17:34 +00:00
|
|
|
|
2023-07-29 07:14:59 +00:00
|
|
|
oci_push_to_registry ${seafile_image}:${seafile_release}
|