Spaces:
Sleeping
Sleeping
File size: 827 Bytes
d5684b3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# Pull the official PostgreSQL 16 image
FROM postgres:16
# Create a directory for the database files
RUN mkdir -p /var/lib/postgresql/data
# Change the ownership of the data directory
RUN chown -R postgres:postgres /var/lib/postgresql/data
# Copy the configuration files into the data directory
# NOTE: the [f] suffix is to ensure that the COPY command will not fail if the files don't exist
COPY ./pg_hba.con[f] /var/lib/postgresql/data/pg_hba.conf
COPY ./postgresql.con[f] /var/lib/postgresql/data/postgresql.conf
# Include environment variables for the PostgreSQL user and password
ENV POSTGRES_USER=${POSTGRES_USER}
ENV POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
# Expose the default PostgreSQL port
EXPOSE 5432
# Start the PostgreSQL server
CMD ["postgres", "-c", "config_file=/var/lib/postgresql/data/postgresql.conf"]
|