#!/bin/bash

cd ..
FRESHRSS_VERSION=$(grep "'FRESHRSS_VERSION'" constants.php | cut -d "'" -f4)
echo "$FRESHRSS_VERSION"

if [[ $DOCKERFILE_PATH == *-ARM ]]; then
	#TODO: Add --squash --platform arm options when Docker Hub daemon supports them
	docker build \
		--build-arg FRESHRSS_VERSION="$FRESHRSS_VERSION" \
		--build-arg SOURCE_BRANCH="$SOURCE_BRANCH" \
		--build-arg SOURCE_COMMIT="$SOURCE_COMMIT" \
		-f "$DOCKERFILE_PATH" -t "$IMAGE_NAME" .
else
	#TODO: Add --squash option when Docker Hub daemon supports it
	docker build \
		--build-arg FRESHRSS_VERSION="$FRESHRSS_VERSION" \
		--build-arg SOURCE_BRANCH="$SOURCE_BRANCH" \
		--build-arg SOURCE_COMMIT="$SOURCE_COMMIT" \
		-f "$DOCKERFILE_PATH" -t "$IMAGE_NAME" .
fi
