-
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.
- Loading branch information
Showing
5 changed files
with
506 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,44 @@ | ||
--- | ||
name: Build pgbouncer image | ||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- pgbouncer/** | ||
- .github/workflows/pgbouncer.yml | ||
workflow_dispatch: | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
version: ['1.22.0'] | ||
steps: | ||
- name: Check-out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up QEMU (for multi-arch build) | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push image to registry | ||
uses: docker/build-push-action@v5 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
context: ./pgbouncer | ||
file: ./pgbouncer/Dockerfile | ||
push: true | ||
build-args: | | ||
VERSION=${{ matrix.version }} | ||
tags: | | ||
ghcr.io/f-bn/pgbouncer:${{ matrix.version }} |
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
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,63 @@ | ||
# --- Build stage --- | ||
FROM docker.io/gcc:13.2 AS build | ||
|
||
ARG TARGETOS | ||
ARG TARGETARCH | ||
ARG VERSION=1.22.0 | ||
|
||
RUN set -ex ; \ | ||
export DEBIAN_FRONTEND=noninteractive ; \ | ||
apt update ; \ | ||
apt install -y --no-install-recommends \ | ||
ca-certificates \ | ||
wget \ | ||
libc6-dev \ | ||
libevent-dev \ | ||
libssl-dev \ | ||
libc-ares-dev \ | ||
libpq-dev \ | ||
pkg-config | ||
|
||
WORKDIR /build | ||
|
||
RUN set -ex ; \ | ||
wget -O pgbouncer-${VERSION}.tar.gz https://www.pgbouncer.org/downloads/files/${VERSION}/pgbouncer-${VERSION}.tar.gz ; \ | ||
wget -O pgbouncer-${VERSION}.tar.gz.sha256 https://www.pgbouncer.org/downloads/files/${VERSION}/pgbouncer-${VERSION}.tar.gz.sha256 ; \ | ||
cat pgbouncer-${VERSION}.tar.gz.sha256 | sha256sum -c ; \ | ||
tar -xzf pgbouncer-${VERSION}.tar.gz --strip-components=1 | ||
|
||
RUN set -ex ; \ | ||
./configure --prefix=/usr ; \ | ||
make -j2 | ||
|
||
# --- Final stage --- | ||
FROM cgr.dev/chainguard/wolfi-base:latest | ||
|
||
ARG VERSION=1.22.0 | ||
|
||
COPY --from=build --chmod=755 /build/pgbouncer /usr/bin/pgbouncer | ||
COPY --chown=nonroot:nonroot --chmod=640 pgbouncer.default.ini /etc/pgbouncer/pgbouncer.ini | ||
|
||
RUN set -ex ; \ | ||
mkdir -p /etc/pgbouncer /var/run/pgbouncer ; \ | ||
touch /etc/pgbouncer/userlist.txt ; \ | ||
chown -R nonroot:nonroot /etc/pgbouncer /var/run/pgbouncer ; | ||
|
||
RUN apk add --no-cache c-ares libevent | ||
|
||
USER nonroot | ||
|
||
EXPOSE 6432/tcp | ||
|
||
STOPSIGNAL SIGINT | ||
|
||
ENTRYPOINT [ "/usr/bin/pgbouncer" ] | ||
|
||
CMD [ "/etc/pgbouncer/pgbouncer.ini" ] | ||
|
||
LABEL \ | ||
org.opencontainers.image.title="pgbouncer" \ | ||
org.opencontainers.image.source="https://github.com/f-bn/containers-images/pgbouncer" \ | ||
org.opencontainers.image.description="Lightweight connection pooler for PostgreSQL" \ | ||
org.opencontainers.image.licenses="ISC" \ | ||
org.opencontainers.image.authors="Florian Bobin <contact@fbobin.me>" |
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,18 @@ | ||
## General informations | ||
|
||
Custom PgBouncer image builded from sources. | ||
|
||
Built with GCC 13.2. | ||
|
||
### Supported PgBouncer versions | ||
|
||
- PgBouncer 1.22.x | ||
|
||
## PgBouncer configuration | ||
|
||
By default, this image is builded with a default empty PgBouncer configuration. You can bring your own configuration to the container (e.g using Docker): | ||
|
||
```shell | ||
# By default, the image is looking for configuration in /etc/pgbouncer/pgbouncer.ini | ||
$ docker run [options] -v pgbouncer.ini:/etc/pgbouncer/pgbouncer.ini ghcr.io/f-bn/pgbouncer:1.22.0 | ||
``` |
Oops, something went wrong.