diff --git a/.gitignore b/.gitignore index 96ef6c0..bb23f66 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target +/artifacts Cargo.lock diff --git a/Dockerfile.arm64v8 b/Dockerfile.arm64v8 new file mode 100644 index 0000000..71fb670 --- /dev/null +++ b/Dockerfile.arm64v8 @@ -0,0 +1,6 @@ +FROM arm64v8/nginx:mainline-alpine + +COPY html/ /usr/share/nginx/html/ + +RUN chown -R nginx:nginx /usr/share/nginx/html + diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..59461dc --- /dev/null +++ b/build.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash + +BUILD_DATE=$(date) +VERSION=$1 +MIGRATIONS=$2 + +function require() { + if [ "$1" = "" ]; then + echo "input '$2' required" + print_help + exit 1 + fi +} + +function print_help() { + echo "build.sh" + echo "" + echo "Usage:" + echo " build.sh [version]" + echo "" + echo "Args:" + echo " version: The version of the current container" +} + +require "$VERSION" "version" + +if ! docker run --rm -it arm64v8/ubuntu:19.10 /bin/bash -c 'echo "docker is configured correctly"'; then + echo "docker is not configured to run on qemu-emulated architectures, fixing will require sudo" + sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes +fi + +set -xe + +cargo doc + +mkdir -p artifacts +rm -rf artifacts/html +cp -r ./target/doc artifacts/html + +docker build \ + --pull \ + --no-cache \ + --build-arg BUILD_DATE="${BUILD_DATE}" \ + --build-arg TAG="${TAG}" \ + -f Dockerfile.arm64v8 \ + -t "asonix/activitystreams-new-docs:${VERSION}-arm64v8" \ + -t "asonix/activitystreams-new-docs:latest-arm64v8" \ + -t "asonix/activitystreams-new-docs:latest" \ + ./artifacts + +docker push "asonix/activitystreams-new-docs:${VERSION}-arm64v8" +docker push "asonix/activitystreams-new-docs:latest-arm64v8" +docker push "asonix/activitystreams-new-docs:latest"