postgres / Dockerfile
bpandey23's picture
Update Dockerfile
0a5ecea verified
raw
history blame
1.08 kB
# Use the latest Ubuntu image as the base
FROM ubuntu:latest
# Install necessary packages
RUN apt-get update && apt-get install -y \
curl \
wget \
unzip \
git \
python3-pip \
libmagic-dev \
lsb-release \
lsof \
postgresql \
gnupg
# Install the PostgreSQL 16 repository key
RUN curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg
# Install PostgreSQL 16 client and server
RUN apt-get update && apt-get install -y postgresql-client-16 postgresql-server-dev-16
# Create the foobar user and group
RUN groupadd -r foobar && useradd -r -g foobar foobar
# Create the PostgreSQL data directory and set permissions
RUN mkdir -p /var/lib/postgresql/data && \
chown -R foobar:foobar /var/lib/postgresql/data
# Copy the entrypoint script to the container
COPY entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/entrypoint.sh
# Expose the default PostgreSQL port
EXPOSE 5432
# Set the ENTRYPOINT to the entrypoint script
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]