# Use the official PostgreSQL image as the base image | |
FROM postgres:13 | |
# Set the environment variables for the PostgreSQL database | |
ENV POSTGRES_DB=mydb | |
ENV POSTGRES_USER=myuser | |
ENV POSTGRES_PASSWORD=mypassword | |
# Copy any custom SQL scripts to the container | |
COPY init.sql /docker-entrypoint-initdb.d/ | |
# Expose the default PostgreSQL port | |
EXPOSE 5432 | |
# Start the PostgreSQL server when the container is launched | |
CMD ["postgres"] | |