-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-push.sh
More file actions
executable file
·35 lines (27 loc) · 1.09 KB
/
docker-push.sh
File metadata and controls
executable file
·35 lines (27 loc) · 1.09 KB
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
35
#!/bin/bash
# Script for pushing Docker images with version tags
# Usage: ./docker-push.sh [version]
# If no version is provided, only pushes 'latest' tag
VERSION=$1
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
if [ -n "$VERSION" ]; then
echo "Pushing Docker images with version $VERSION..."
# Tag and push main gogen image
docker tag clintsharp/gogen:latest clintsharp/gogen:$VERSION
docker push clintsharp/gogen:$VERSION
docker push clintsharp/gogen:latest
# Tag and push gogen-api image if it exists
if docker images | grep -q "clintsharp/gogen-api"; then
docker tag clintsharp/gogen-api:latest clintsharp/gogen-api:$VERSION
docker push clintsharp/gogen-api:$VERSION
docker push clintsharp/gogen-api:latest
fi
else
echo "Pushing Docker images with 'latest' tag only..."
docker push clintsharp/gogen:latest
# Push gogen-api if it exists
if docker images | grep -q "clintsharp/gogen-api"; then
docker push clintsharp/gogen-api:latest
fi
fi
echo "Docker push completed successfully!"