Files
backend/build/nginx/build.sh

64 lines
1.7 KiB
Bash
Raw Normal View History

2025-05-01 19:26:39 +02:00
#!/bin/bash
2025-05-03 10:54:14 +02:00
# ---------------------------------------------------------------------------
# setting constants
2025-05-03 10:13:07 +02:00
PACKAGE_REPOSITORY=proxima.goliath.hu/proxima/backend
2025-05-01 19:26:39 +02:00
BUILD_TAG=nginx
2025-05-03 10:13:07 +02:00
UID=$(id -u)
GID=$(id -g)
2025-05-01 19:26:39 +02:00
2025-05-03 10:54:14 +02:00
# ---------------------------------------------------------------------------
clear
echo This is a sample build script, if the workflow cannot be used.
echo Please customize the repository address/name for your own.
echo
2025-05-01 19:26:39 +02:00
# ---------------------------------------------------------------------------
2025-05-03 10:13:07 +02:00
echo Building "${BUILD_TAG}" package ..
2025-05-01 19:26:39 +02:00
echo
# ---------------------------------------------------------------------------
echo Changing to project root directory...
pushd ../.. > /dev/null
# ---------------------------------------------------------------------------
echo Building assets...
pushd src > /dev/null
npm run build
popd > /dev/null
# ---------------------------------------------------------------------------
echo Determining tag name...
branch=$(git branch --show-current)
tag=${PACKAGE_TAG:-temp}
2025-05-03 10:13:07 +02:00
[[ $branch == dev ]] && tag=testing
[[ $branch == main ]] && tag=latest
[[ $branch == master ]] && tag=latest
2025-05-01 19:26:39 +02:00
# ---------------------------------------------------------------------------
echo Building image...
2025-05-03 10:13:07 +02:00
docker build . \
2025-05-01 19:26:39 +02:00
--tag ${PACKAGE_REPOSITORY}:$tag \
2025-05-03 10:13:07 +02:00
--build-arg GROUP_ID=${GID} \
--build-arg USER_ID=${UID} \
2025-05-01 19:26:39 +02:00
--file build/${BUILD_TAG}/Dockerfile \
2025-05-03 10:13:07 +02:00
--platform linux/amd64,linux/arm64 \
--provenance=false \
--sbom=false \
2025-05-01 19:26:39 +02:00
# --push \
# ---------------------------------------------------------------------------
echo Changing back to build directory...
popd > /dev/null
# ---------------------------------------------------------------------------
echo Done.