DockerImages/PterodactylImages/Minecraft-Paper/auto-builder.sh

31 lines
959 B
Bash
Raw Normal View History

#!/bin/bash
# DockerHub username
DOCKERHUB_USERNAME="vetheon"
# Array of Java versions
JAVA_VERSIONS=("8" "11" "16" "17" "18" "19" "20" "21" "22")
# Base path to Dockerfiles
2024-06-25 08:39:20 -06:00
BASE_PATH="./Ridged-Java"
# Loop through each Java version, build, tag, and push the Docker images
for VERSION in "${JAVA_VERSIONS[@]}"; do
IMAGE_NAME="${DOCKERHUB_USERNAME}/pterodactyl-images:java_${VERSION}"
DOCKERFILE_PATH="${BASE_PATH}/${VERSION}/Dockerfile"
# Build the Docker image
2024-06-25 08:39:20 -06:00
if [ -f "${DOCKERFILE_PATH}" ]; then
echo "Building Docker image for Java ${VERSION}..."
docker build -t "${IMAGE_NAME}" -f "${DOCKERFILE_PATH}" .
2024-06-25 08:39:20 -06:00
# Push the Docker image to DockerHub
echo "Pushing Docker image for Java ${VERSION} to DockerHub..."
docker push "${IMAGE_NAME}"
else
echo "Dockerfile for Java ${VERSION} not found at ${DOCKERFILE_PATH}"
fi
done
echo "All images have been built and pushed successfully."