File: Dockerfile.debian

package info (click to toggle)
pgaudit-17 17.1-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 332 kB
  • sloc: ansic: 1,358; sql: 1,174; makefile: 25; sh: 6
file content (39 lines) | stat: -rw-r--r-- 1,274 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
FROM ubuntu:jammy

# Install packages
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y sudo wget gnupg tzdata locales lsb-release apt-utils make gcc libssl-dev \
    libkrb5-dev

# Create postgres user/group with specific IDs
ARG UID=1000
ARG GID=1000

RUN groupadd -g $GID -o postgres
RUN useradd -m -u $UID -g $GID -o -s /bin/bash postgres

# Add PostgreSQL repository
RUN RELEASE_CODENAME=`lsb_release -c | awk '{print $2}'` && \
    echo 'deb http://apt.postgresql.org/pub/repos/apt/ '${RELEASE_CODENAME?}'-pgdg main 17' | \
        tee -a /etc/apt/sources.list.d/pgdg.list
RUN APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 && \
    wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
RUN apt-get update

# Install PostgreSQL
ENV PGVERSION=17

RUN apt-get install -y postgresql-${PGVERSION?} postgresql-server-dev-${PGVERSION?}

# Create PostgreSQL cluster
ENV PGBIN=/usr/lib/postgresql/${PGVERSION}/bin
ENV PGDATA="/var/lib/postgresql/${PGVERSION}/test"
ENV PATH="${PATH}:${PGBIN}"

RUN sudo -u postgres ${PGBIN?}/initdb -A trust -k ${PGDATA?}
RUN echo "shared_preload_libraries = 'pgaudit'" >> ${PGDATA}/postgresql.conf

# Configure sudo
RUN echo 'postgres ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers

USER postgres