feat: create tables for db on build

This commit is contained in:
Nemo D'ACREMONT 2024-10-26 09:28:18 +02:00
parent 6d566f74db
commit ba5e136dd5
No known key found for this signature in database
GPG Key ID: 6E5BCE8022FA8276
2 changed files with 11 additions and 1 deletions

7
PostgreSQL/Dockerfile Normal file
View File

@ -0,0 +1,7 @@
FROM postgres:17
WORKDIR /db
# postgresql will execute the files in that folder after build
COPY tables/tables.sql /docker-entrypoint-initdb.d/

View File

@ -2,6 +2,9 @@ services:
database:
hostname: database
container_name: briques_postgres
build:
context: ./PostgreSQL
dockerfile: Dockerfile
image: postgres
restart: always
environment:
@ -11,7 +14,7 @@ services:
ports:
- 5432:5432
volumes:
- ./database:/var/lib/postgresql/data
- ./dev-db:/var/lib/postgresql/data
adminer:
image: adminer