Add some docker DB bootstrap stuff
This commit is contained in:
Родитель
8c0e90fbe1
Коммит
f8a57627eb
|
@ -37,6 +37,7 @@ authentication: false
|
|||
database:
|
||||
type: postgres
|
||||
name: ssh_observatory
|
||||
username: sshobs
|
||||
server: 127.0.0.1
|
||||
port: 5432
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
psql -v ON_ERROR_STOP=1 --username "sshobs" <<-EOSQL
|
||||
CREATE DATABASE ssh_observatory;
|
||||
GRANT ALL PRIVILEGES ON DATABASE ssh_observatory TO sshobs;
|
||||
EOSQL
|
|
@ -1,12 +1,17 @@
|
|||
version: '2'
|
||||
services:
|
||||
database:
|
||||
image: postgres:latest
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./docker/database
|
||||
environment:
|
||||
POSTGRES_USER: sshobs
|
||||
PGDATA: /data/postgres
|
||||
volumes:
|
||||
- ./data/postgres:/data/postgres
|
||||
networks:
|
||||
- default
|
||||
volumes:
|
||||
- ./data/db:/data/db
|
||||
restart: always
|
||||
restart: unless-stopped
|
||||
api:
|
||||
build:
|
||||
context: .
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
FROM postgres
|
||||
MAINTAINER Jonathan Claudius
|
||||
ADD ./database/init-user-db.sh /docker-entrypoint-initdb.d/
|
||||
ADD ./database/schema.sql /docker-entrypoint-initdb.d/
|
Загрузка…
Ссылка в новой задаче