-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdev.Dockerfile
59 lines (43 loc) · 1.45 KB
/
dev.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
58
59
FROM python:3.10.12
ARG MY_ENV
ENV MY_ENV=${MY_ENV} \
PYTHONFAULTHANDLER=1 \
PYTHONUNBUFFERED=1 \
PYTHONHASHSEED=random \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
POETRY_VERSION=1.5.0
ENV user=alab
ENV SIEM_MTAD_GAT_FOLDER=siem-mtad-gat
# Update and install depencencies
RUN apt update --fix-missing
RUN apt-get install -y git python3-pip graphviz
# Install pipx
RUN python3 -m pip install pipx
RUN python3 -m pipx ensurepath
# Create a non-root user
RUN useradd -ms /bin/bash ${user} && echo '${user} ALL=(ALL) NOPASSWD:ALL' >>/etc/sudoers
# Add location where pip is installed to the PATH variable
ENV PATH="/home/${user}/.local/bin:${PATH}"
# Copy the files and install the python environment as user alab
USER ${user}
# RUN pip3 install pipenv
RUN pip3 install poetry=="${POETRY_VERSION}"
WORKDIR /home/${user}/${SIEM_MTAD_GAT_FOLDER}
COPY poetry.lock pyproject.toml /home/${user}/${SIEM_MTAD_GAT_FOLDER}/
# Project initialization
RUN poetry install
# Creating folders, and files for a project
COPY . /home/${user}/${SIEM_MTAD_GAT_FOLDER}
# Install python virtual environment for the project
WORKDIR /home/${user}/${SIEM_MTAD_GAT_FOLDER}
# RUN pipenv install
# Install Doorstop
RUN pipx install doorstop==3.0b10
# Clean up unnecessary packages
USER root
RUN apt-get autoremove -y && apt-get autoclean -y
# Set the container starting point, running the project as the user
USER ${user}
CMD ["poetry", "shell"]