authelia/.buildkite/hooks/pre-artifact

28 lines
1.2 KiB
Plaintext
Raw Normal View History

#!/bin/bash
set +u
DOCKER_IMAGE=authelia/authelia
if [[ $BUILDKITE_LABEL == ":hammer_and_wrench: Unit Test" ]]; then
tar -czf authelia-public_html.tar.gz -C dist public_html
sha256sum authelia-public_html.tar.gz > authelia-public_html.tar.gz.sha256
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-"${OS}"-"${ARCH}"
docker rm -f authelia-binary
if [[ $OS == "linux" ]]; then
tar -czf authelia-"${OS}"-"${ARCH}".tar.gz authelia-"${OS}"-"${ARCH}" authelia.service config.template.yml
else
tar -czf authelia-"${OS}"-"${ARCH}".tar.gz authelia-"${OS}"-"${ARCH}" config.template.yml
fi
sha256sum authelia-"${OS}"-"${ARCH}".tar.gz > authelia-"${OS}"-"${ARCH}".tar.gz.sha256
# Saving image for push to docker hub, darwin image is not required as OSX utilses linux manifests
if [[ $BUILDKITE_LABEL != ":docker: Build Image [darwin]" ]]; then
docker save ${DOCKER_IMAGE} | zstdmt -T0 -12 > authelia-image-"${ARCH}".tar.zst
fi
fi