buildx/hugo/hugo.sh
Adrien le Maire 2f83b43b23 Update hugo/Dockerfile, hugo/hugo.sh, hugo/Makefile, .gitlab-ci.yml files
Deleted borg/Dockerfile, borg/Makefile, borg/version, dendrite/Dockerfile, dendrite/Makefile, dendrite/entrypoint.sh, dendrite/version, minio/Dockerfile, minio/Makefile, minio/version, restic/Dockerfile, restic/Makefile, restic/version, watchdog/Dockerfile, watchdog/Makefile, watchdog/version files
2021-05-08 11:01:13 +00:00

50 lines
1.3 KiB
Bash

#!/bin/sh
# This file is triggered inside the _base/Dockerfile-base file.
set -e
set -u
# Variables
# HUGO_VERSION is edited in Dockerfile.
# Architecture
TARGETPLATFORM=${TARGETPLATFORM:-linux/amd64}
if [ "$TARGETPLATFORM" = "linux/amd64" ]; then
HUGO_ARCH="64bit"
elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then
HUGO_ARCH="ARM64"
elif [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then
HUGO_ARCH="ARM"
else
echo "Unknown build architecture: $TARGETPLATFORM"
exit 2
fi
# Download binaries from release
wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-${HUGO_ARCH}.tar.gz
wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_checksums.txt
# Verify checksums
grep hugo_${HUGO_VERSION}_Linux-${HUGO_ARCH}.tar.gz hugo_${HUGO_VERSION}_checksums.txt | sha256sum -c
# Prepare folders
mkdir -p /usr/local/bin/
# Unpack downloaded content
tar -zxf hugo_${HUGO_VERSION}_Linux-${HUGO_ARCH}.tar.gz -C /usr/local/bin
# Verify executable
/usr/local/bin/hugo version
# Create autocompletion script
mkdir -p /etc/bash_completion.d
/usr/local/bin/hugo gen autocomplete > /etc/bash_completion.d/hugo.sh
# Create version file
echo -n "${HUGO_VERSION}" > /etc/hugo-release
# Remove binaries
rm hugo_${HUGO_VERSION}_Linux-${HUGO_ARCH}.tar.gz hugo_${HUGO_VERSION}_checksums.txt