From a56e2e1a1f2e79ad698b7176a1024437f94662bb Mon Sep 17 00:00:00 2001 From: SM Date: Tue, 4 Feb 2025 11:48:26 -0500 Subject: [PATCH] Added requirements for faster builds --- DockerBuildPush.sh | 30 ++++++++++++++++++++++++++++++ Dockerfile | 6 ++++++ requirements.txt | 2 ++ 3 files changed, 38 insertions(+) create mode 100644 DockerBuildPush.sh create mode 100644 requirements.txt diff --git a/DockerBuildPush.sh b/DockerBuildPush.sh new file mode 100644 index 0000000..d3cac10 --- /dev/null +++ b/DockerBuildPush.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# Get the directory of the script (which should be the root of your repo) +SCRIPT_DIR=$(dirname "$(realpath "$0")") + +# Set variables +FULL_IMAGE_NAME="registry.gitlab.com/sascha3333/python-uv-base:latest" + +# Pull the latest changes from the Git repository +echo "Pulling the latest changes from the Git repository..." +git pull origin main + +# Enable BuildKit for multi-platform builds +export DOCKER_BUILDKIT=1 + +# Ensure Buildx is set up for multi-platform builds +echo "Setting up Buildx for multi-platform builds..." +if ! docker buildx inspect multiarch-builder > /dev/null 2>&1; then + docker buildx create --name multiarch-builder --use + docker buildx inspect --bootstrap +fi + +# Build and push the Docker image for both ARM and AMD architectures +echo "Building and pushing multi-platform Docker image..." +docker buildx build \ + --platform linux/arm64,linux/amd64 \ + --tag $FULL_IMAGE_NAME \ + --push . + +echo "Docker image built and pushed successfully: $FULL_IMAGE_NAME" diff --git a/Dockerfile b/Dockerfile index f807dfb..40e9b7d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,3 +6,9 @@ WORKDIR /usr/src/app # Install uv directly using pip RUN pip install uv + +# Common helper modules to speed up future builds +COPY requirements.txt . + +# Install dependencies using uv +RUN uv pip install --system -r requirements.txt \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..7288a6d --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +apprise +psycopg2-binary \ No newline at end of file