# Use the official PostgreSQL image from the Docker Hub | |
FROM postgres:latest | |
# Environment variables for PostgreSQL setup | |
ENV POSTGRES_DB='mydatabase' | |
ENV POSTGRES_USER='myuser' | |
ENV POSTGRES_PASSWORD='mypassword' | |
# Copy the custom PostgreSQL configuration file | |
COPY postgresql.conf ./postgresql.conf | |
# Copy initialization scripts to the Docker container | |
COPY init.sql /docker-entrypoint-initdb.d/ | |
# Expose the custom port | |
EXPOSE 7860 | |
# Run PostgreSQL with the custom configuration file | |
CMD ["postgres", "-c", "config_file=/etc/postgresql/postgresql.conf"] | |