Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -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