File size: 933 Bytes
e9d2120
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM python:3.11-slim-buster AS Build

ENV PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1 \
    POETRY_NO_INTERACTION=1 \
    POETRY_VIRTUALENVS_CREATE=false \
    POETRY_VERSION=1.7.1

WORKDIR /app

COPY ./pyproject.toml /app/

RUN apt-get update && \
    apt-get install -y gcc g++ unixodbc-dev && \
    pip install "poetry==$POETRY_VERSION" && \
    poetry export --without-hashes --format requirements.txt --output requirements.txt && \
    python3 -m pip wheel --no-cache-dir --no-deps -w /app/wheels -r requirements.txt

FROM python:3.11-slim-buster AS Run

ENV HOME=/home/user \
	PATH=/home/user/.local/bin:$PATH

RUN useradd -m -u 1000 user

USER user

COPY --from=build /app/wheels $HOME/app/wheels

WORKDIR $HOME/app/wheels

RUN pip3 --no-cache-dir install *.whl

COPY --chown=user ./palmyra-fin-chat $HOME/app

WORKDIR $HOME/app

ENTRYPOINT [ "writer", "run" ]
EXPOSE 8080
CMD [ ".",  "--port", "8080", "--host", "0.0.0.0" ]