Skip to content
Snippets Groups Projects
Select Git revision
  • 4c10d32bb685223e62755a70d15bb5fc0bc4c99d
  • main default protected
2 results

Containerfile.postgres.tmpl

Blame
  • Containerfile.postgres.tmpl 570 B
    # Use the official PostgreSQL image
    FROM postgres:latest
    
    # Set build-time variables
    ARG DB_USER
    ARG DB_PASSWORD
    ARG DB_DATABASE
    ARG POSTGRES_PASSWORD
    
    # Set environment variables
    ENV POSTGRES_USER=$DB_USER
    ENV POSTGRES_PASSWORD=$DB_PASSWORD
    ENV POSTGRES_DB=$DB_DATABASE
    
    # Copy your SQL scripts from the root directory
    COPY ./sql/ /docker-entrypoint-initdb.d/
    
    # Add a script to create the database in the correct order
    COPY ./import-sql.sh /docker-entrypoint-initdb.d/
    
    # Grant execution permissions to the script
    RUN chmod +x /docker-entrypoint-initdb.d/import-sql.sh