Files
thoughts/deploy.sh
Gabriel Kaszewski 61c82d77ba
Some checks failed
lint / lint (push) Has been cancelled
test / unit (push) Has been cancelled
test / integration (push) Has been cancelled
lint / lint (pull_request) Has been cancelled
test / unit (pull_request) Has been cancelled
test / integration (pull_request) Has been cancelled
chore: deploy.sh builds and pushes both backend and frontend images
2026-05-15 01:27:06 +02:00

29 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
REGISTRY="registry.gabrielkaszewski.dev"
BACKEND_IMAGE="$REGISTRY/thoughts:latest"
FRONTEND_IMAGE="$REGISTRY/thoughts-frontend:latest"
# Public API URL seen by the browser.
# Override with: NEXT_PUBLIC_API_URL=https://api.example.com ./deploy.sh
API_URL="${NEXT_PUBLIC_API_URL:-https://thoughts.gabrielkaszewski.dev}"
# Internal API URL used by Next.js SSR (can be a Docker-internal address in prod).
# Override with: NEXT_PUBLIC_SERVER_SIDE_API_URL=http://api:8000 ./deploy.sh
SSR_API_URL="${NEXT_PUBLIC_SERVER_SIDE_API_URL:-$API_URL}"
echo "==> building backend image: $BACKEND_IMAGE"
docker buildx build --platform linux/amd64 \
-t "$BACKEND_IMAGE" --push .
echo "==> building frontend image: $FRONTEND_IMAGE"
docker buildx build --platform linux/amd64 \
--build-arg "NEXT_PUBLIC_API_URL=$API_URL" \
--build-arg "NEXT_PUBLIC_SERVER_SIDE_API_URL=$SSR_API_URL" \
-t "$FRONTEND_IMAGE" --push \
./thoughts-frontend
echo "==> pushed $BACKEND_IMAGE"
echo "==> pushed $FRONTEND_IMAGE"