Skip to content

Commit

Permalink
Merge pull request #1 from goto/add-workflow
Browse files Browse the repository at this point in the history
feat: add build and push workflow
  • Loading branch information
mabdh authored Jun 4, 2024
2 parents 9449ab5 + 1be656f commit 257bfde
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/build-and-docker-push.yml
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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/*


0 comments on commit 257bfde

Please sign in to comment.