vibeStonk/scripts/build_docker.sh
2025-06-12 16:57:42 -04:00

47 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
set -xe
cd $GOPATH/src/vibeStonk || exit
# Build the project first to generate the static assets and server binary
./scripts/generate_proto.sh
./scripts/build.sh
# Set the image ID (you can replace this with a version or commit hash)
IMAGE_ID=$(git rev-parse --short HEAD 2>/dev/null || echo "latest")
# Registry URL
REGISTRY="registry.geniuscartel.xyz/stonk"
# Build and push the static image
echo "Building and pushing static image..."
docker buildx create --name multiarch-builder --use || true
docker buildx inspect --bootstrap
# Build and push the static image for multiple architectures
#docker buildx build --platform linux/amd64,linux/arm64 \
# -t ${REGISTRY}/static:${IMAGE_ID} \
# -t ${REGISTRY}/static:latest \
# -f docker/Dockerfile.static \
# --push \
# .
docker buildx build --platform linux/arm64 \
-t ${REGISTRY}/static:${IMAGE_ID} \
-t ${REGISTRY}/static:latest \
-f docker/Dockerfile.static \
--push \
.
# Build and push the API image for multiple architectures
echo "Building and pushing API image..."
docker buildx build --platform linux/amd64,linux/arm64 \
-t ${REGISTRY}/api:${IMAGE_ID} \
-t ${REGISTRY}/api:latest \
-f docker/Dockerfile.api \
--push \
.
echo "Docker images built and pushed successfully with tags: ${IMAGE_ID} and latest"
echo "Static images: ${REGISTRY}/static:${IMAGE_ID} and ${REGISTRY}/static:latest"
echo "API images: ${REGISTRY}/api:${IMAGE_ID} and ${REGISTRY}/api:latest"