-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from goto/add-workflow
feat: add build and push workflow
- Loading branch information
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/* | ||
|
||
|