-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
57 lines (45 loc) · 1.41 KB
/
Dockerfile
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
51
52
53
54
55
56
57
#############
# Dependencies
#
# This base stage just installs the dependencies required for production
# without any development deps.
ARG PYTHON_VER=3.8
FROM python:${PYTHON_VER} AS base
WORKDIR /usr/src/app
RUN pip install -U pip && \
curl -sSL https://install.python-poetry.org | python3 -
ENV PATH="/root/.local/bin:$PATH"
RUN poetry config virtualenvs.create false
# Install project manifest
COPY pyproject.toml poetry.lock ./
RUN poetry install --no-root
############
# Unit Tests
#
# This test stage runs true unit tests (no outside services) at build time, as
# well as enforcing codestyle and performing fast syntax checks. It is built
# into an image with docker-compose for running the full test suite.
FROM base AS test
COPY . .
RUN poetry install --no-interaction
############
# Linting
#
# Runs all necessary linting and code checks
RUN echo 'Running Flake8' && \
flake8 . && \
echo 'Running Black' && \
black --check --diff . && \
echo 'Running Pylint' && \
find . -name '*.py' | xargs pylint && \
echo 'Running Yamllint' && \
yamllint . && \
echo 'Running pydocstyle' && \
pydocstyle . && \
echo 'Running Bandit' && \
bandit --recursive ./ --configfile .bandit.yml
RUN pytest --color yes -vvv tests
# Run full test suite including integration
ENTRYPOINT ["pytest"]
# Default to running colorful, verbose pytests
CMD ["--cov=ttp_sros_parser", "--color=yes", "-vvv"]