diff --git a/.dockerignore b/.dockerignore index 33629eb..899ec24 100644 --- a/.dockerignore +++ b/.dockerignore @@ -5,3 +5,5 @@ # Каталог с данными **/data/ +.env* +.init* diff --git a/.gitignore b/.gitignore index a236708..6936a56 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,5 @@ **/logs/ .env* +.init* alembic.ini diff --git a/docker-compose.yml b/docker-compose.yml index fd4f0c4..3bf758e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,7 +21,7 @@ services: restart: always volumes: - ./data/db:/var/lib/postgresql/data - - ./init.sql:/docker-entrypoint-initdb.d/10-init.sql + - ./.init.sql:/docker-entrypoint-initdb.d/10-init.sql env_file: - .env.db diff --git a/env.db b/env.db new file mode 100644 index 0000000..1bea368 --- /dev/null +++ b/env.db @@ -0,0 +1 @@ +POSTGRES_PASSWORD=postgrespassword diff --git a/init.sql b/init.sql new file mode 100644 index 0000000..52ab797 --- /dev/null +++ b/init.sql @@ -0,0 +1,3 @@ +CREATE DATABASE myapp; +CREATE USER appuser WITH PASSWORD 'BIGPASSWORD'; +GRANT ALL PRIVILEGES ON DATABASE myapp to appuser;