Add the database data
This commit is contained in:
parent
e6d6427ddc
commit
b3c2ff8de0
3 changed files with 37 additions and 0 deletions
2
db/dockerfile
Normal file
2
db/dockerfile
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
from mysql:8
|
||||||
|
add init.sql /docker-entrypoint-initdb.d
|
||||||
9
db/init.sql
Normal file
9
db/init.sql
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
create database if not exists tqna;
|
||||||
|
|
||||||
|
create table if not exists tqna.questions (
|
||||||
|
`__id` integer not null auto_increment primary key,
|
||||||
|
`channel` text,
|
||||||
|
`asker` text,
|
||||||
|
`question` text,
|
||||||
|
`answered` boolean
|
||||||
|
);
|
||||||
|
|
@ -15,6 +15,8 @@ services:
|
||||||
disable: true
|
disable: true
|
||||||
volumes:
|
volumes:
|
||||||
- "./api:/app"
|
- "./api:/app"
|
||||||
|
links:
|
||||||
|
- "db"
|
||||||
|
|
||||||
stdin_open: true
|
stdin_open: true
|
||||||
tty: true
|
tty: true
|
||||||
|
|
@ -34,3 +36,27 @@ services:
|
||||||
|
|
||||||
stdin_open: true
|
stdin_open: true
|
||||||
tty: true
|
tty: true
|
||||||
|
|
||||||
|
db:
|
||||||
|
build:
|
||||||
|
context: "./database"
|
||||||
|
docker: "dockerfile"
|
||||||
|
restart: "unless-stopped"
|
||||||
|
volumes:
|
||||||
|
- "./data:/var/lib/mysql"
|
||||||
|
environment:
|
||||||
|
MYSQL_ROOT_PASSWORD: "root"
|
||||||
|
healthcheck:
|
||||||
|
test: "mysqladmin ping -h localhost"
|
||||||
|
timeout: 30s
|
||||||
|
retries: 5
|
||||||
|
start_period: 60s
|
||||||
|
|
||||||
|
adminer:
|
||||||
|
image: adminer
|
||||||
|
ports:
|
||||||
|
- "8081:8080"
|
||||||
|
depends_on:
|
||||||
|
- "db"
|
||||||
|
links:
|
||||||
|
- "db"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue