services-garbaye/podman-seafile/ci_build-images.sh

31 lines
1.7 KiB
Bash
Raw Normal View History

2022-03-05 19:41:45 +00:00
#!/usr/bin/env bash
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
source ${ABSDIR}/../functions.sh
source ${ABSDIR}/vars.sh
ensure_pwd_is_scriptdir
ensure_not_root
buildfolder=/tmp/seafile-$$
if ! podman image exists ${seafile_image}:${seafile_release}; then
mkdir ${buildfolder} &&
git clone --depth=1 https://github.com/haiwen/seafile-docker.git ${buildfolder}/ &&
2023-03-01 22:51:00 +00:00
sed_in_place "^FROM phusion/baseimage:focal-1.2.0" "FROM docker.io/phusion/baseimage:focal-1.2.0" ${buildfolder}/image/seafile_${seafile_release%.*}/Dockerfile &&
sed_in_place "SEAFILE_VERSION=" "SEAFILE_VERSION=${seafile_release}" ${buildfolder}/image/seafile_${seafile_release%.*}/Dockerfile &&
2023-03-01 22:51:00 +00:00
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 &&
2023-03-02 08:41:00 +00:00
sed_in_place 'wget https://seafile-downloads.oss-cn-shanghai.aliyuncs.com/seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz' 'wget -q https://s3.eu-central-1.amazonaws.com/download.seadrive.org/seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz' ${buildfolder}/image/seafile_${seafile_release%.*}/Dockerfile &&
2023-03-02 09:25:09 +00:00
sed_in_place 'tar -zxvf' 'tar -zxf' ${buildfolder}/image/seafile_${seafile_release%.*}/Dockerfile &&
2022-03-05 19:41:45 +00:00
podman build -t ${seafile_image}:${seafile_release} \
-f ${buildfolder}/image/seafile_${seafile_release%.*}/Dockerfile \
2023-03-01 22:51:00 +00:00
${buildfolder} &&
podman rmi phusion/baseimage:focal-1.2.0
2022-03-05 19:41:45 +00:00
rm -rf ${buildfolder}
else
echo "Image ${seafile_image}:${seafile_release} already built"
2022-03-05 19:41:45 +00:00
fi
oci_push_to_registry ${seafile_image}:${seafile_release}