23 lines
564 B
Docker
23 lines
564 B
Docker
# Database initialization container
|
|
FROM docker.io/library/postgres:16-alpine
|
|
|
|
# Install postgresql-client for psql command
|
|
RUN apk add --no-cache postgresql-client
|
|
|
|
# Copy migrations
|
|
COPY migrations /migrations
|
|
|
|
# Copy initialization script
|
|
COPY scripts/init-db.sh /usr/local/bin/init-db.sh
|
|
RUN chmod +x /usr/local/bin/init-db.sh
|
|
|
|
# Set default environment variables
|
|
ENV DB_HOST=db \
|
|
DB_USER=user \
|
|
DB_PASSWORD=password \
|
|
DB_NAME=coppertone_db \
|
|
MIGRATIONS_DIR=/migrations
|
|
|
|
# Run the initialization script
|
|
ENTRYPOINT ["/usr/local/bin/init-db.sh"]
|