-
Notifications
You must be signed in to change notification settings - Fork 265
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (37 loc) · 1.2 KB
/
Dockerfile
File metadata and controls
51 lines (37 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
FROM python:3.10-slim
# Setting environment variables for Python
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PIP_NO_CACHE_DIR=off
ENV ALEMBIC_CONFIG=/usr/src/config/alembic.ini
# Installing dependencies
RUN apt update && apt install -y \
gcc \
libpq-dev \
netcat-openbsd \
postgresql-client \
dos2unix \
&& apt clean
# Install Poetry
RUN python -m pip install --upgrade pip && \
pip install poetry
# Copy dependency files
COPY ./poetry.lock /usr/src/poetry/poetry.lock
COPY ./pyproject.toml /usr/src/poetry/pyproject.toml
# Copy pytest config file
COPY ./pytest.ini /usr/src/config/pytest.ini
# Configure Poetry to avoid creating a virtual environment
RUN poetry config virtualenvs.create false
# Selecting a working directory
WORKDIR /usr/src/poetry
# Install dependencies with Poetry
RUN poetry lock
RUN poetry install --no-root
# Selecting a working directory
WORKDIR /usr/src/fastapi
# Copy the source code
COPY ./src .
COPY ./alembic.ini /usr/src/config/alembic.ini
COPY ./commands /commands
RUN dos2unix /commands/*.sh && chmod +x /commands/*.sh
CMD ["pytest", "-c", "/usr/src/config/pytest.ini", "-m", "e2e", "--maxfail=5", "--disable-warnings", "-v", "--tb=short"]