Gateway source moved out of src/ subdirectory but Dockerfile still referenced old paths, breaking docker build. Rewrite to use tsx runtime (no tsc/esbuild compile step), copy all workspace package.json for lockfile compatibility, and filter install to gateway deps only (616 vs 1911 packages). Also update build-and-push script to tag latest. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
48 lines
1.2 KiB
Bash
Executable file
48 lines
1.2 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
GATEWAY_DIR="$(dirname "$SCRIPT_DIR")"
|
|
PROJECT_ROOT="$(cd "$GATEWAY_DIR/../.." && pwd)"
|
|
|
|
REPO="085931705009.dkr.ecr.us-west-2.amazonaws.com/super-multica/gateway"
|
|
BRANCH="$(git symbolic-ref --short -q HEAD | tr '/' '-')"
|
|
IMAGE_TAG="$(date +%F_%H-%M-%S)-${BRANCH}-$(git rev-parse --short HEAD)"
|
|
IMAGE="$REPO:$IMAGE_TAG"
|
|
IMAGE_LATEST="$REPO:latest"
|
|
|
|
# Determine if sudo is needed for docker commands
|
|
if [[ "$(uname -s)" == "Linux" ]]; then
|
|
DOCKER_CMD="sudo docker"
|
|
else
|
|
DOCKER_CMD="docker"
|
|
fi
|
|
|
|
echo "Building image: $IMAGE"
|
|
echo "Using Dockerfile: $GATEWAY_DIR/Dockerfile"
|
|
echo "Build context: $PROJECT_ROOT"
|
|
echo ""
|
|
|
|
# Login to ECR
|
|
aws ecr get-login-password --region us-west-2 | $DOCKER_CMD login --username AWS --password-stdin 085931705009.dkr.ecr.us-west-2.amazonaws.com
|
|
|
|
# Build from project root with gateway Dockerfile
|
|
START_TIME=$(date +%s)
|
|
$DOCKER_CMD build \
|
|
-f "$GATEWAY_DIR/Dockerfile" \
|
|
-t "$IMAGE" \
|
|
-t "$IMAGE_LATEST" \
|
|
"$PROJECT_ROOT"
|
|
END_TIME=$(date +%s)
|
|
echo ""
|
|
echo "Build completed in $((END_TIME - START_TIME))s"
|
|
|
|
# Push both tags
|
|
$DOCKER_CMD push "$IMAGE"
|
|
$DOCKER_CMD push "$IMAGE_LATEST"
|
|
|
|
echo ""
|
|
echo "Successfully pushed:"
|
|
echo " $IMAGE"
|
|
echo " $IMAGE_LATEST"
|