diff --git a/.dockerignore b/.dockerignore index 76bfd39..1d5e5ef 100644 --- a/.dockerignore +++ b/.dockerignore @@ -8,4 +8,5 @@ htmlcov .coverage .env docs -*.pyc \ No newline at end of file +*.pyc +!tests/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index a6bbfa5..ea79268 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,8 @@ WORKDIR /app COPY requirements.txt . RUN pip install --no-cache-dir --prefix=/install -r requirements.txt +COPY app ./app + FROM python:3.12.10-slim-bookworm RUN useradd -m app @@ -18,4 +20,4 @@ USER app EXPOSE 8000 -CMD ["uvicorn","app.main:app","--host","0.0.0.0","--port","8000"] \ No newline at end of file +CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"] \ No newline at end of file diff --git a/Dockerfile.test b/Dockerfile.test new file mode 100644 index 0000000..cf76478 --- /dev/null +++ b/Dockerfile.test @@ -0,0 +1,15 @@ +FROM python:3.12.10-slim-bookworm + +WORKDIR /app + +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +COPY app ./app +COPY tests ./tests +COPY pytest.ini* ./ +ENV DATABASE_URL=sqlite:///./test.db \ + APP_PORT=8000 \ + LOG_LEVEL=INFO + +RUN python -m pytest -v \ No newline at end of file