szuru/server/hooks/test
2020-03-06 18:15:25 -05:00

35 lines
607 B
Bash
Executable File

#!/bin/sh
set -e
docker build \
--build-arg BASE_IMAGE=${IMAGE_NAME} \
--file - \
--tag ${IMAGE_NAME}-test \
. <<'EOF'
ARG BASE_IMAGE
FROM ${BASE_IMAGE}
WORKDIR /opt/app
USER root
RUN apk --no-cache add \
py3-pytest \
py3-pytest-cov \
postgresql \
&& \
pip3 install \
--no-cache-dir \
--disable-pip-version-check \
pytest-pgsql \
freezegun
USER app
ENV POSTGRES_HOST=x \
POSTGRES_USER=x \
POSTGRES_PASSWORD=x \
ESEARCH_HOST=x
CMD ["pytest", "szurubooru/", \
"--cov-report=term-missing", "--cov=szurubooru", "--tb=short"]
EOF
docker run --rm -t ${IMAGE_NAME}-test
exit $?