-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-push.sh
More file actions
executable file
·34 lines (27 loc) · 943 Bytes
/
docker-push.sh
File metadata and controls
executable file
·34 lines (27 loc) · 943 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# Simple Docker build and push script
set -e
# Configuration
DOCKERHUB_USERNAME="${DOCKERHUB_USERNAME:-exempl4r}"
IMAGE_NAME="cfmn-backend"
TAG="latest"
# Check if GOOGLE_CLIENT_ID is set
if [ -z "$GOOGLE_CLIENT_ID" ]; then
echo "Error: GOOGLE_CLIENT_ID environment variable is not set"
echo "Please set it with: export GOOGLE_CLIENT_ID=your_client_id"
exit 1
fi
echo "Building and pushing $DOCKERHUB_USERNAME/$IMAGE_NAME:$TAG..."
# Login to Docker Hub (interactive if no password set)
if [ -n "$DOCKERHUB_PASSWORD" ]; then
echo "$DOCKERHUB_PASSWORD" | docker login --username "$DOCKERHUB_USERNAME" --password-stdin
else
docker login --username "$DOCKERHUB_USERNAME"
fi
# Build and push
docker buildx build \
--push \
--tag "$DOCKERHUB_USERNAME/$IMAGE_NAME:$TAG" \
--build-arg "VITE_GOOGLE_CLIENT_ID=$GOOGLE_CLIENT_ID" \
.
echo "Done! Image pushed to $DOCKERHUB_USERNAME/$IMAGE_NAME:$TAG"