shiori/scripts/buildx.sh
Felipe Martin 647945c54e
ci: unify local and ci docker workflows (#907)
* deps: go to 1.22.3

* removed ci dockerfile

* add make buildx

* updated dockerfile

* ci uses make buildx command

* commented upx for the future

* disable openbsd/arm tests

* wip

* put dist file in dist path

* removed unused make command

* build-local to speed up local tests

* don't clean when buildx

* podman workaround

* manually define source files for tests
2024-05-14 08:01:52 +02:00

30 lines
897 B
Bash
Executable file

#!/usr/bin/env bash
set -ex
# Check if the shiori_builder builder exists
if [ "$CONTAINER_RUNTIME" == "docker" ]; then
if [ -z "$($CONTAINER_RUNTIME buildx ls | grep shiori_builder)" ]; then
echo "Creating shiori_builder builder"
$CONTAINER_RUNTIME buildx create --use --name shiori_builder
fi
fi
if [[ -d "dist/shiori_linux_arm_7" ]]; then
cp -r dist/shiori_linux_arm_7 dist/shiori_linux_armv7
fi
if [[ -d "dist/shiori_linux_amd64_v1" ]]; then
cp -r dist/shiori_linux_amd64_v1 dist/shiori_linux_amd64
fi
$CONTAINER_RUNTIME buildx build \
-f ${CONTAINERFILE_NAME} \
--platform=${BUILDX_PLATFORMS} \
--build-arg "ALPINE_VERSION=${CONTAINER_ALPINE_VERSION}" \
--build-arg "GOLANG_VERSION=${GOLANG_VERSION}" \
${CONTAINER_BUILDX_OPTIONS} \
.
if [ "$CONTAINER_RUNTIME" == "docker" ]; then
$CONTAINER_RUNTIME buildx rm shiori_builder
fi