Debian Codegraph @

.devcontainer/Dockerfile

raw
1 ##
2 ## =====================================================================================
3 ## C O P Y R I G H T
4 ## -------------------------------------------------------------------------------------
5 ## Copyright (c) 2023 by Robert Bosch GmbH. All rights reserved.
6 ##
7 ## Author(s):
8 ## - Markus Braun, :em engineering methods AG (contracted by Robert Bosch GmbH)
9 ## - Stefan Schulz, itemis AG (contracted by Robert Bosch GmbH)
10 ## =====================================================================================
11 ##
12
13 ARG VARIANT=3.12
14 FROM --platform=linux/amd64 mcr.microsoft.com/devcontainers/python:${VARIANT}
15
16 LABEL maintainer="Bosch Doxysphinx Team <https://github.com/boschglobal/doxysphinx/>"
17
18 # default shell = zsh
19 SHELL [ "/bin/zsh", "-c" ]
20
21 # set environment
22 ENV PYTHONUNBUFFERED 1
23 ENV TZ=Europe/Berlin
24 ENV PATH="/root/.local/bin:/home/vscode/.local/bin:${PATH}"
25
26 # Install apt dependencies
27 # - default-jre for running plantuml
28 # - graphviz for plantuml/doxygen (however that's already provided by the base image - still we have it here in case we'd switch..)
29 # - doxygen
30 # - imagemagick (sphinx dependency)
31 RUN apt-get update \
32 && export DEBIAN_FRONTEND=noninteractive \
33 && apt-get install --no-install-recommends -y \
34 default-jre \
35 graphviz \
36 doxygen \
37 imagemagick \
38 && apt-get autoremove \
39 && apt-get clean \
40 && rm -rf /var/lib/apt/lists/*
41
42 # Update doxygen to latest
43 RUN wget -c https://www.doxygen.nl/files/doxygen-1.11.0.linux.bin.tar.gz -O /tmp/doxygen.tar.gz \
44 && mkdir -p /tmp/doxygen \
45 && tar -xzvf /tmp/doxygen.tar.gz --strip-components=1 -C /tmp/doxygen/ \
46 && mv /tmp/doxygen/bin/* /usr/bin \
47 && mv /tmp/doxygen/man/man1/* /usr/share/man/man1 \
48 && rm -rf /tmp/doxygen/
49
50 # Install plantUML
51 RUN wget -c https://netcologne.dl.sourceforge.net/project/plantuml/plantuml.jar -O /tmp/plantuml.jar && \
52 mkdir -p /usr/share/plantuml && \
53 mv /tmp/plantuml.jar /usr/share/plantuml/plantuml.jar
54
55 # Switch to vscode user
56 USER vscode
57
58 # set workspace dir and ensure it's present
59 # set cache home directory to in-repo directory (so it will survive container rebuilds and speed up startup
60 # and dependency resolution)
61 ARG WORKSPACE_DIR
62 WORKDIR ${WORKSPACE_DIR}/
63
64 # set cache home directory to in-repo directory (so it will survive container rebuilds and speed up startup
65 # and dependency resolution)
66 ENV XDG_CACHE_HOME=${WORKSPACE_DIR}/.cache
67
68 # Install poetry (we're not use pipx here because poetry in a virtualenv has it's issues...)
69 RUN curl -sSL https://install.python-poetry.org | python3 - \
70 && poetry completions bash >> ~/.bash_completion
71
72 # Install poetry up plugin to update dependencies
73 RUN poetry self add poetry-plugin-up
74
75 # Install precommit globally in the container (with pipx installation we had error messages during pre-commit
76 # checks like "/usr/local/bin/python: No module named pre_commit" - seems it needs the python module available
77 # in the global python environment
78 RUN pip install pre-commit
79
80 # Inject + Install QA tooling
81 RUN pipx inject flake8 flake8-bugbear flake8-comprehensions flake8-simplify cohesion pydocstyle \
82 flake8-docstrings pep8-naming \
83 && pipx inject mypy lxml-stubs types-PyYAML \
84 && pipx install isort \
85 && pipx install safety \
86 && pipx install commitizen
87
88 # install pytest
89 RUN pipx install pytest && pipx inject pytest pytest-cov pytest-emoji pytest-md
90
91 # install pex for packaging
92 RUN pipx install pex
93
94 # for pylint we would need to install c libs in it's pipx env and also whitelist them in pyproject.toml
95 # thats the reason why we deactivated that for now...
96 #RUN pipx inject pylint lxml mpire
97
98 # note that installation of dependencies and pre-commit installation will be done after vscode has started
99 # the container.