authelia/.buildkite/hooks/pre-artifact
Amir Zarrinkafsh 1b39d28cbe
Optimise Buildkite steps
* Utilise multi-threaded zstd for compression

* Fix container removal on dirty exit

* Optimise build step agents
2020-01-07 22:28:04 +11:00

26 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
set +u
DOCKER_IMAGE=authelia/authelia
if [[ $BUILDKITE_COMMAND == "authelia-scripts --log-level debug ci" ]];
then
echo "--- :go::node: Saving artifacts for :chrome::selenium: Integration tests"
tar -I 'zstdmt -T0 -12' -cf dist.tar.zst dist
tar -I 'zstdmt -T0 -12' -cf web.tar.zst web
fi
if [[ $BUILDKITE_LABEL =~ ":docker: Build Image" ]];
then
echo "--- :docker: Saving artifacts for :buildkite: :docker: :github: releases"
# Save binary for buildkite and github artifacts
docker create --name authelia-binary $DOCKER_IMAGE:latest
docker cp authelia-binary:/usr/app/authelia ./authelia-linux-"${ARCH}"
docker cp authelia-binary:/usr/app/public_html ./
docker rm -f authelia-binary
tar -I 'zstdmt -T0 -12' -cf authelia-linux-"${ARCH}".tar.zst authelia-linux-"${ARCH}" public_html
sha256sum authelia-linux-"${ARCH}".tar.zst > authelia-linux-"${ARCH}".tar.zst.sha256
# Saving image for push to DockerHub
docker save $DOCKER_IMAGE | zstdmt -T0 -12 > authelia-image-"${ARCH}".tar.zst
fi