diff --git a/.github/workflows/build-and-docker-push.yml b/.github/workflows/build-and-docker-push.yml new file mode 100644 index 0000000..12631e6 --- /dev/null +++ b/.github/workflows/build-and-docker-push.yml @@ -0,0 +1,33 @@ +name: Build and Push Docker Image + +on: + # Run workflow on push events to the main branch + push: + branches: [ main ] + +jobs: + build-and-push: + runs-on: ubuntu-latest # Replace with your preferred runner + + steps: + - name: Checkout code + uses: actions/checkout@v3 # Fetches code from your repository + + - name: Login to Docker Hub (using secrets) + uses: docker/login-action@v2 # Official Docker login action + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set up Docker Buildx (optional for multi-platform builds) + uses: docker/setup-buildx-action@v3 # Optional for multi-arch builds + + - name: Build Docker image (using build args) + uses: docker/build-push-action@v5 # Official Docker build and push action + with: + push: true # Push image to Docker Hub + tags: ${{ secrets.DOCKERHUB_USERNAME }}/postgres-partman:1.0.0 # Replace with your desired tag + context: . + platforms: linux/amd64,linux/arm64 + build-args: | # Pass environment variables to build process + POSTGRES_VERSION=15 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..83285b9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +ARG POSTGRES_VERSION +FROM postgres:$POSTGRES_VERSION + +RUN apt-get update && apt-get install unzip && apt-get --assume-yes install build-essential && apt-get --assume-yes install postgresql-server-dev-11 && apt-get install -y wget \ +&& wget https://github.com/pgpartman/pg_partman/archive/refs/tags/v4.7.4.zip -O 4.7.4.zip \ +&& unzip 4.7.4.zip \ +&& cd /pg_partman-4.7.4 && pwd && make NO_BGW=1 install + + +RUN apt-get update && \ + apt-get -y install postgresql-15-cron && \ + apt-get clean \ + && rm -rf /var/lib/apt/lists/* + + \ No newline at end of file