-
Notifications
You must be signed in to change notification settings - Fork 4
/
dockerfile
executable file
·44 lines (31 loc) · 1.07 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
FROM python:3.12-slim as builder
ENV LANG=C.UTF-8
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PATH="/app/venv/bin:$PATH"
WORKDIR /app
RUN apt-get update \
&& apt-get install -y gcc procps \
&& dpkg --add-architecture arm64 \
&& apt-get purge -y --auto-remove \
&& rm -rf /var/lib/apt/lists/*
RUN pip install poetry==1.6.1
COPY poetry.lock pyproject.toml /app/
COPY src /app/src
RUN python -m venv /app/venv && \
. /app/venv/bin/activate && \
poetry config virtualenvs.create false && \
poetry install --no-dev
FROM python:3.12-slim
WORKDIR /app
ENV PYTHONUNBUFFERED=1
ENV PATH="/venv/bin:$PATH"
ENV PYTHONPATH=$PYTHONPATH:.:/app
COPY src/jattach /app/openjdk/jattach
COPY --from=builder /app/venv /venv
COPY src /app/src
RUN echo '#!/bin/bash\npython /app/src/java_toolkit/main.py $@' > /usr/bin/java-toolkit && \
chmod +x /usr/bin/java-toolkit
# -u disables stdout buffering https://stackoverflow.com/questions/107705/disable-output-buffering
# TODO: use -u in developer builds only
CMD exec /bin/bash -c "trap : TERM INT; sleep infinity & wait"