Skip to content

Commit 04807ee

Browse files
committed
github action and readme update
1 parent 5209675 commit 04807ee

File tree

2 files changed

+63
-2
lines changed

2 files changed

+63
-2
lines changed

.github/workflows/build-and-push.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}/mpg-operator-postgres
11+
12+
jobs:
13+
build-and-push:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v3
25+
26+
- name: Log in to the Container registry
27+
uses: docker/login-action@v3
28+
with:
29+
registry: ${{ env.REGISTRY }}
30+
username: ${{ github.actor }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Build and push Docker image
34+
uses: docker/build-push-action@v5
35+
with:
36+
context: .
37+
push: true
38+
cache-from: type=gha
39+
cache-to: type=gha,mode=max

README.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ This image works with the Percona PostgreSQL Operator architecture:
1313
1. Patroni is the process manager that starts and manages PostgreSQL
1414
2. Our wrapper script sets the OOM score adjustment to -1000 for the Patroni process
1515
3. This adjustment is inherited by PostgreSQL processes, protecting them from OOM killer
16-
4. Custom PostgreSQL configuration is provided to optimize memory usage
17-
5. The wrapper script preserves the original entrypoint behavior of the parent image
16+
4. The wrapper script preserves the original entrypoint behavior of the parent image
1817

1918
## Usage
2019

@@ -25,6 +24,29 @@ docker build -t oom-protected-postgres .
2524
docker run -d --name postgres oom-protected-postgres
2625
```
2726

27+
## Continuous Integration / Deployment
28+
29+
This repository includes a GitHub Action that automatically builds and pushes the Docker image to GitHub Container Registry (ghcr.io) whenever changes are pushed to the main branch.
30+
31+
### Automated Builds
32+
33+
The workflow:
34+
1. Builds the Docker image
35+
2. Tags it with both `latest` and the short commit SHA
36+
3. Pushes it to GitHub Container Registry
37+
38+
### Using the Pre-built Image
39+
40+
Once built, you can pull the image directly:
41+
42+
```bash
43+
docker pull ghcr.io/[your-username]/mpg-postgres-image/oom-protected-postgres:latest
44+
```
45+
46+
### GitHub Action Configuration
47+
48+
The GitHub Action configuration is defined in `.github/workflows/build-and-push.yml`. If you fork this repository, you'll need to ensure your repository has permission to push packages. You can configure this in your repository settings under "Actions" > "General" > "Workflow permissions".
49+
2850
## References
2951

3052
- [PostgreSQL documentation on kernel resources](https://www.postgresql.org/docs/current/kernel-resources.html)

0 commit comments

Comments
 (0)