File size: 1,217 Bytes
6ca4b94
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ubuntu:24.04

ARG DEV_MODE

ENV DEV_MODE=${DEV_MODE:-false}

ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1

RUN apt update 

RUN apt install -y \
    python3.12 \
    python3.12-dev \
    python3.12-venv \
    python3-pip

RUN ln -sf /usr/bin/python3 /usr/bin/python && ln -sf /usr/bin/pip3 /usr/bin/pip

RUN apt install -y \
    curl \
    git \
    git-lfs \
    locales && \
    git lfs install && \
    sed -i 's/# \(en_US.UTF-8 UTF-8\)/\1/' /etc/locale.gen && \
    locale-gen && \
    rm -rf /var/lib/apt/lists/*

RUN apt update && \
    apt install -y nodejs npm && \
    rm -rf /var/lib/apt/lists/*

ENV LANG=en_US.UTF-8 \
    LC_ALL=en_US.UTF-8

RUN curl -sSL https://install.python-poetry.org | python - && \
    ln -sf ~/.local/bin/poetry /usr/local/bin/poetry

RUN poetry config virtualenvs.in-project true

WORKDIR /app

EXPOSE 80 7860

COPY pyproject.toml poetry.lock* ./

RUN if [ "$DEV_MODE" = "false" ]; then \
    echo "🏭 Production mode: Clean build without cache"; \
    poetry install --no-root --no-interaction --no-ansi --with data,ml,dev; \
    fi

COPY . /app

RUN chmod +x /app/scripts/*.sh || true

ENTRYPOINT ["/app/scripts/entrypoint.sh"]