I want to init my service
in the test stage using a sql
file.
test:
services:
- postgres:latest
variables:
POSTGRES_DB: test
stage: test
image: gliderlabs/herokuish:latest
script:
- setup_test_db
- cp -R . /tmp/app
- /bin/herokuish buildpack test
only:
- branches
except:
variables:
- $TEST_DISABLED
This is the test job as in auto devops
.
I want to use the postgres image docker-entrypoint
.
This is how I use it in docker-compose
on my pc:
volumes:
- './src/sql:/docker-entrypoint-initdb.d'
This way, when the postres
image starts up, I have my schema ready to use.
How can I manage to do it in gitlab-ci.yml
?
command:
hash easier. This is what works for me (I'm posting in JSON because code blocks are not supported in comments):{"command":["/bin/sh","-c","cat >>/docker-entrypoint-initdb.d/init.sql <<EOF && /usr/local/bin/docker-enforce-initdb.sh && su postgres -c postgres\nCREATE ROLE bol_gen_ro WITH NOLOGIN NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION;\nCREATE ROLE bol_gen_rw WITH NOLOGIN NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION;\nEOF\n"]}
. – Uninspired