File tree 3 files changed +28
-0
lines changed
3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ /usr/local/bin/docker-gen mariadb.tmpl /tmp/sql.sh
4
+ while true ;
5
+ do
6
+ ls -l /tmp/sql.sh
7
+ source /tmp/sql.sh
8
+ /usr/local/bin/docker-gen --watch mariadb.tmpl /tmp/sql.sh
9
+ done
Original file line number Diff line number Diff line change
1
+ FROM jwilder/docker-gen AS docker-gen
2
+ FROM mariadb:latest
3
+ COPY --from=docker-gen /usr/local/bin/docker-gen /usr/local/bin/docker-gen
4
+ COPY mariadb-entrypoint.sh /
5
+ COPY mariadb.tmpl /
6
+ ENTRYPOINT ["/mariadb-entrypoint.sh" ]
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ {{ range $index , $value := . }}
4
+
5
+ {{ if $value .Env.DB_HOST }}
6
+ # TODO: Save password from dbserver startup into files then read config
7
+ /usr/bin/mysql -h{{$value .Env.DB_HOST}} -ppass -e '
8
+ CREATE USER IF NOT EXISTS `{{$value.Env.DB_USER}}` IDENTIFIED BY "{{$value.Env.DB_PASS}}";
9
+ CREATE SCHEMA IF NOT EXISTS `{{$value.Env.DB_SCHEMA}}`;
10
+ GRANT ALL ON `{{$value.Env.DB_SCHEMA}}`.* TO `{{$value.Env.DB_USER}}`@`%`;
11
+ '
12
+ {{ end }}
13
+ {{end}}
You can’t perform that action at this time.
0 commit comments