Skip to content

Commit 1bd3630

Browse files
authored
Upgrading image (#6)
* removed gcc and upgraded pydantic gcc adds a lot of vunerabilities * updated dockerfile * removed un-needed installs
1 parent 40c0228 commit 1bd3630

File tree

3 files changed

+130
-107
lines changed

3 files changed

+130
-107
lines changed

Dockerfile

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,47 @@
1-
FROM python:3.8-slim-buster
1+
FROM python:3.12-slim as builder
2+
3+
ENV LANG=C.UTF-8
4+
ENV PYTHONDONTWRITEBYTECODE=1
5+
ENV PYTHONUNBUFFERED=1
6+
ENV PATH="/app/venv/bin:$PATH"
7+
8+
WORKDIR /app
9+
210
RUN apt-get update \
3-
&& apt-get install -y --no-install-recommends procps gdb git curl \
4-
&& apt-get install -y gcc python3-dev \
11+
&& apt-get install -y --no-install-recommends procps gdb \
12+
&& apt-get install -y gcc\
513
&& dpkg --add-architecture arm64 \
614
&& apt-get purge -y --auto-remove \
715
&& rm -rf /var/lib/apt/lists/*
16+
RUN pip install poetry==1.6.1
817

9-
RUN curl -sSL https://install.python-poetry.org | python3 -
10-
RUN /root/.local/bin/poetry config virtualenvs.create false
1118
COPY poetry.lock pyproject.toml /app/
12-
WORKDIR /app/
13-
RUN /root/.local/bin/poetry install --no-interaction --no-root
1419

1520
COPY src /app/src
16-
RUN /root/.local/bin/poetry install
1721

18-
CMD exec /bin/bash -c "trap : TERM INT; sleep infinity & wait"
22+
RUN python -m venv /app/venv && \
23+
. /app/venv/bin/activate && \
24+
poetry config virtualenvs.create false && \
25+
poetry install --no-dev
26+
27+
FROM python:3.12-slim
28+
29+
RUN apt-get update \
30+
&& apt-get install -y --no-install-recommends procps gdb \
31+
&& dpkg --add-architecture arm64 \
32+
&& apt-get purge -y --auto-remove \
33+
&& rm -rf /var/lib/apt/lists/*
34+
35+
36+
ENV PYTHONUNBUFFERED=1
37+
ENV PATH="/venv/bin:$PATH"
38+
ENV PYTHONPATH=$PYTHONPATH:.:/app
39+
COPY --from=builder /app/venv /venv
40+
COPY --from=builder /app /app
41+
42+
RUN echo '#!/bin/bash\npython /app/src/debug_toolkit/main.py $@' > /usr/bin/debug-toolkit && \
43+
chmod +x /usr/bin/debug-toolkit
44+
45+
# -u disables stdout buffering https://stackoverflow.com/questions/107705/disable-output-buffering
46+
# TODO: use -u in developer builds only
47+
CMD exec /bin/bash -c "trap : TERM INT; sleep infinity & wait"

0 commit comments

Comments
 (0)