Pass in api url

This commit is contained in:
john 2025-05-18 14:51:30 +02:00
parent 447a38f519
commit 12e0d87388
2 changed files with 10 additions and 1 deletions

View file

@ -1,3 +1,7 @@
# Assuming your app runs `vite build`
ARG VITE_API_URL
ENV VITE_API_URL=$VITE_API_URL
# Stage 1: Build the Vite React app
FROM node:22-alpine AS builder

View file

@ -7,6 +7,10 @@ REGISTRY="docker.botris.dev"
USERNAME="johnbotris"
IMAGE_NAME="femto-webapp"
# Add this before the docker build line
export VITE_API_URL="https://femto-api.botris.social"
# Step 0: Ensure clean working directory
if [[ -n $(git status --porcelain) ]]; then
echo "❌ Uncommitted changes detected. Please commit or stash them before running this script."
@ -25,7 +29,8 @@ echo "📦 New version: $NEW_VERSION"
# Step 3: Attempt Docker build
echo "🔧 Building Docker image..."
if ! docker build -t $IMAGE_NAME .; then
if ! docker build --build-arg VITE_API_URL="$VITE_API_URL" -t $IMAGE_NAME .; then
echo "❌ Docker build failed. Reverting version bump..."
git checkout -- package.json yarn.lock
exit 1