Skip to content

Commit

Permalink
Merge pull request #1337 from dmitry-sinina/pg16
Browse files Browse the repository at this point in the history
images for pg16
  • Loading branch information
dmitry-sinina authored Sep 10, 2023
2 parents 6577a75 + 066c7ae commit 75bfa27
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,27 @@ jobs:
file: ci/pg15.Dockerfile
push: true
tags: ghcr.io/${{ github.repository_owner }}/yeti-web/pgsql:15

postgres-16-build-image:
name: Build Postgresql 16 images for CI
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push db image
uses: docker/build-push-action@v2
with:
context: .
file: ci/pg16.Dockerfile
push: true
tags: ghcr.io/${{ github.repository_owner }}/yeti-web/pgsql:16
43 changes: 43 additions & 0 deletions ci/pg16.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FROM debian:bookworm

ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=C.UTF-8
ENV PGVER=16
ENV PGCONFIG=/etc/postgresql/$PGVER/main/postgresql.conf
RUN apt-get update && \
apt-get -y dist-upgrade && \
apt-get -y --no-install-recommends install curl gnupg ca-certificates

RUN curl https://pkg.yeti-switch.org/key.gpg | apt-key add - && \
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
echo "deb http://pkg.yeti-switch.org/debian/bookworm 1.12 main" >> /etc/apt/sources.list && \
echo "deb http://apt.postgresql.org/pub/repos/apt/ bookworm-pgdg main" >> /etc/apt/sources.list

RUN apt-get update && \
apt-get -y --no-install-recommends install \
postgresql-$PGVER \
postgresql-contrib-$PGVER \
postgresql-$PGVER-prefix \
postgresql-$PGVER-pgq3 \
postgresql-$PGVER-pgq-ext \
postgresql-$PGVER-pllua \
postgresql-$PGVER-yeti

RUN sed -Ei "/^#?listen_addresses +=/s/.*/listen_addresses = '*'/" "$PGCONFIG" && \
sed -Ei "/^#?log_connections +=/s/.*/log_connections = on/" "$PGCONFIG" && \
sed -Ei "/^#?log_disconnections +=/s/.*/log_disconnections = on/" "$PGCONFIG" && \
sed -Ei "/^#?fsync +=/s/.*/fsync = off/" "$PGCONFIG" && \
sed -Ei "/^#?synchronous_commit +=/s/.*/synchronous_commit = off/" "$PGCONFIG" && \
sed -Ei "/^#?checkpoint_timeout +=/s/.*/checkpoint_timeout = 50min/" "$PGCONFIG" && \
sed -Ei "/^#?ssl +=/s/.*/ssl = off/" "$PGCONFIG" && \
sed -Ei "/^#?autovacuum +=/s/.*/autovacuum = off/" "$PGCONFIG" && \
echo "shared_preload_libraries = 'yeti_pg_ext'" >> $PGCONFIG && \
cat "$PGCONFIG" && \
echo "host all all 0.0.0.0/0 trust" >> /etc/postgresql/$PGVER/main/pg_hba.conf && \
echo "host all all ::/0 trust" >> /etc/postgresql/$PGVER/main/pg_hba.conf

EXPOSE 5432
USER postgres:postgres
ENTRYPOINT ["/usr/lib/postgresql/16/bin/postgres", \
"-D", "/var/lib/postgresql/16/main", \
"-c", "config_file=/etc/postgresql/16/main/postgresql.conf"]

0 comments on commit 75bfa27

Please sign in to comment.