committed by
GitHub
parent
f0b7526847
commit
df05e2dab3
54
sh/docker-build
Executable file
54
sh/docker-build
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
|
||||
APP=$1
|
||||
VERSION=$2
|
||||
|
||||
if [ -z "$APP" ]; then
|
||||
echo "Please provide an app name as an argument."
|
||||
echo "Usage: $0 <app_name> <version>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if version is provided
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "Please provide a version number as an argument."
|
||||
echo "Usage: $0 $APP <version>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Ensure Docker Buildx is available and set up a builder
|
||||
docker buildx create --use --name multi-arch-builder || true
|
||||
|
||||
# Function to build a multi-architecture image
|
||||
build_image() {
|
||||
local app=$1
|
||||
local image_name="lindesvard/openpanel-$app"
|
||||
|
||||
echo "Building multi-architecture image for $image_name:$VERSION"
|
||||
|
||||
docker buildx build \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
-t "$image_name:$VERSION" \
|
||||
-t "$image_name:latest" \
|
||||
--build-arg DATABASE_URL="postgresql://p@p:5432/p" \
|
||||
-f "apps/$app/Dockerfile" \
|
||||
--push \
|
||||
.
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to build $image_name:$VERSION"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Successfully built and pushed multi-architecture image for $image_name:$VERSION"
|
||||
}
|
||||
|
||||
if [ "$APP" == "all" ]; then
|
||||
build_image "dashboard"
|
||||
build_image "worker"
|
||||
build_image "api"
|
||||
echo "All multi-architecture images have been built and pushed successfully."
|
||||
else
|
||||
build_image $APP
|
||||
echo "Multi-architecture image for $APP has been built and pushed successfully."
|
||||
fi
|
||||
49
sh/docker-publish
Executable file
49
sh/docker-publish
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
|
||||
APP=$1
|
||||
VERSION=$2
|
||||
|
||||
if [ -z "$APP" ]; then
|
||||
echo "Please provide an app name as an argument."
|
||||
echo "Usage: $0 <app_name> <version>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if version is provided
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "Please provide a version number as an argument."
|
||||
echo "Usage: $0 $APP <version>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Function to push a multi-architecture image
|
||||
push_image() {
|
||||
local app=$1
|
||||
local image_name="lindesvard/openpanel-$app"
|
||||
|
||||
echo "Pushing multi-architecture image for $image_name:$VERSION"
|
||||
|
||||
# Push the versioned tag
|
||||
docker buildx imagetools create -t "$image_name:$VERSION" "$image_name:$VERSION"
|
||||
|
||||
# Push the latest tag
|
||||
docker buildx imagetools create -t "$image_name:latest" "$image_name:$VERSION"
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to push $image_name:$VERSION"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Successfully pushed multi-architecture image for $image_name:$VERSION and latest"
|
||||
}
|
||||
|
||||
# Push each image
|
||||
if [ "$APP" == "all" ]; then
|
||||
push_image "dashboard"
|
||||
push_image "worker"
|
||||
push_image "api"
|
||||
echo "All multi-architecture images have been pushed successfully."
|
||||
else
|
||||
push_image $APP
|
||||
echo "Multi-architecture image for $APP has been pushed successfully."
|
||||
fi
|
||||
Reference in New Issue
Block a user