-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdev.Dockerfile
More file actions
58 lines (43 loc) · 1.78 KB
/
Copy pathdev.Dockerfile
File metadata and controls
58 lines (43 loc) · 1.78 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
51
52
53
54
55
56
57
58
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 SOAR_FOLDER=soar
# Install system dependencies, Node.js 20, and Chromium in a single layer;
# clean up APT cache immediately to avoid baking it into the image
RUN apt-get update --fix-missing \
&& apt-get install -y --no-install-recommends git python3-pip graphviz curl ca-certificates \
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y --no-install-recommends nodejs \
&& apt-get install -y --no-install-recommends chromium || apt-get install -y --no-install-recommends chromium-browser || true \
&& apt-get autoremove -y \
&& apt-get autoclean -y \
&& rm -rf /var/lib/apt/lists/*
# Install Mermaid CLI (global, system-level; runs as root)
RUN npm install -g @mermaid-js/mermaid-cli
# Create a non-root user (no sudo granted)
RUN useradd -ms /bin/bash ${user}
# Add location where pip/pipx install user-scoped tools to the PATH
ENV PATH="/home/${user}/.local/bin:${PATH}"
# Switch to non-root user for all subsequent steps
USER ${user}
# Install pipx and poetry under the user account
RUN python3 -m pip install --no-cache-dir pipx \
&& python3 -m pipx ensurepath \
&& pip3 install --no-cache-dir poetry=="${POETRY_VERSION}"
WORKDIR /home/${user}/${SOAR_FOLDER}
COPY --chown=${user}:${user} poetry.lock pyproject.toml /home/${user}/${SOAR_FOLDER}/
# Project initialization
RUN poetry install --only docs --no-root
# Copy project files with correct ownership
COPY --chown=${user}:${user} . /home/${user}/${SOAR_FOLDER}
# Install Doorstop
RUN pipx install doorstop==3.0b10
CMD ["poetry", "shell"]