Skip to content
Closed
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
17 changes: 17 additions & 0 deletions Dockerfile.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM python:3.11-slim
ARG APP_VERSION=dev
ENV APP_VERSION=${APP_VERSION}
ENV APP_NAME=modal_backend
ENV APP_MODULE=${APP_NAME}.routes.base:app

COPY ./requirements.txt ./requirements.dev.txt /${APP_NAME}/
WORKDIR /${APP_NAME}/
RUN ["/bin/sh", "-c", "pip install -U -r requirements.txt -r requirements.dev.txt"]
CMD ["-l", "-v"]
ENTRYPOINT ["pytest"]

COPY ./pyproject.toml /${APP_NAME}/
COPY ./alembic.ini /${APP_NAME}/
COPY ./migrations /${APP_NAME}/migrations
COPY ./${APP_NAME} /${APP_NAME}/${APP_NAME}
COPY ./tests /${APP_NAME}/tests/
29 changes: 29 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,32 @@ db:

migrate:
source ./venv/bin/activate && alembic upgrade head

pytest-container-build:
docker build -f Dockerfile.test -t pytest-container .

pytest-container-run:
docker run -it \
-v /var/run/docker.sock:/var/run/docker.sock \
--rm \
--add-host host.docker.internal:host-gateway \
-e TESTCONTAINERS_HOST_OVERRIDE=host.docker.internal \
--network host \
pytest-container \
$(ARGS)

pytest-rerun:
docker build -f Dockerfile.test -t pytest-container . \
&& \
docker run -it \
-v /var/run/docker.sock:/var/run/docker.sock \
--rm \
--add-host host.docker.internal:host-gateway \
-e TESTCONTAINERS_HOST_OVERRIDE=host.docker.internal \
--network host \
pytest-container \
$(ARGS)




Loading