mirror of
https://github.com/djrobstep/migra.git
synced 2024-09-11 13:56:05 +03:00
Make testing easier with docker
This commit is contained in:
parent
01acaf2eda
commit
8605fc7117
6
Makefile
6
Makefile
@ -6,7 +6,11 @@ tmessy = -svv
|
||||
targs = --cov-report term-missing --cov migra
|
||||
|
||||
test:
|
||||
$(tcommand) $(tmessy) $(targs) tests
|
||||
docker build -t migra-postgres --build-arg LOCAL_USER=$$USER - < tests/Dockerfile
|
||||
$(eval ID := $(shell docker run -d -p 5432:5432 migra-postgres))
|
||||
$(tcommand) $(tmessy) $(targs) tests || true
|
||||
docker stop $(ID)
|
||||
docker rm $(ID)
|
||||
|
||||
stest:
|
||||
$(tcommand) $(tmessy) $(targs) tests
|
||||
|
8
tests/Dockerfile
Normal file
8
tests/Dockerfile
Normal file
@ -0,0 +1,8 @@
|
||||
FROM postgres:13-alpine
|
||||
|
||||
ENV POSTGRES_HOST_AUTH_METHOD=trust
|
||||
ENV POSTGRES_USER=postgres
|
||||
ARG LOCAL_USER
|
||||
|
||||
RUN printf "psql --username ${POSTGRES_USER} --command=\"CREATE USER ${LOCAL_USER} CREATEDB CREATEROLE;\"" > /docker-entrypoint-initdb.d/10-create-users.sh
|
||||
RUN printf "psql --username ${POSTGRES_USER} --command=\"CREATE DATABASE ${LOCAL_USER};\"" > /docker-entrypoint-initdb.d/20-create-database.sh
|
Loading…
Reference in New Issue
Block a user