Update Dockerfile
Browse files- Dockerfile +10 -21
Dockerfile
CHANGED
|
@@ -3,43 +3,32 @@ FROM python:3.11-slim-buster as builder
|
|
| 3 |
|
| 4 |
RUN apt-get update && apt-get install -y git
|
| 5 |
|
| 6 |
-
RUN pip install poetry==1.4.2
|
| 7 |
-
|
| 8 |
-
ENV POETRY_NO_INTERACTION=1 \
|
| 9 |
-
POETRY_VIRTUALENVS_IN_PROJECT=1 \
|
| 10 |
-
POETRY_VIRTUALENVS_CREATE=1 \
|
| 11 |
-
POETRY_CACHE_DIR=/tmp/poetry_cache
|
| 12 |
-
|
| 13 |
WORKDIR /app
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
RUN poetry install --without dev --no-root && rm -rf $POETRY_CACHE_DIR
|
| 18 |
-
|
| 19 |
-
# The runtime image, used to just run the code provided its virtual environment
|
| 20 |
FROM python:3.11-slim-buster as runtime
|
| 21 |
|
| 22 |
RUN useradd -m -u 1000 user
|
| 23 |
-
|
| 24 |
USER user
|
| 25 |
-
|
| 26 |
ENV HOME=/home/user \
|
| 27 |
PATH="/home/user/.local/bin:$PATH" \
|
| 28 |
VIRTUAL_ENV=/app/.venv \
|
| 29 |
LISTEN_PORT=8000 \
|
| 30 |
-
HOST=0.0.0.0
|
|
|
|
| 31 |
|
| 32 |
WORKDIR $HOME/app
|
| 33 |
|
| 34 |
-
|
| 35 |
-
|
| 36 |
COPY --chown=user ./app ./app
|
| 37 |
COPY --chown=user ./.chainlit ./.chainlit
|
| 38 |
COPY --chown=user chainlit.md ./
|
|
|
|
| 39 |
|
| 40 |
-
|
|
|
|
| 41 |
|
| 42 |
-
|
| 43 |
-
RUN pip install -r app/requirements.txt
|
| 44 |
|
| 45 |
-
|
|
|
|
|
|
| 3 |
|
| 4 |
RUN apt-get update && apt-get install -y git
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
WORKDIR /app
|
| 7 |
|
| 8 |
+
# The runtime image
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
FROM python:3.11-slim-buster as runtime
|
| 10 |
|
| 11 |
RUN useradd -m -u 1000 user
|
|
|
|
| 12 |
USER user
|
|
|
|
| 13 |
ENV HOME=/home/user \
|
| 14 |
PATH="/home/user/.local/bin:$PATH" \
|
| 15 |
VIRTUAL_ENV=/app/.venv \
|
| 16 |
LISTEN_PORT=8000 \
|
| 17 |
+
HOST=0.0.0.0 \
|
| 18 |
+
PYTHONUNBUFFERED=1
|
| 19 |
|
| 20 |
WORKDIR $HOME/app
|
| 21 |
|
| 22 |
+
# Copy application files
|
|
|
|
| 23 |
COPY --chown=user ./app ./app
|
| 24 |
COPY --chown=user ./.chainlit ./.chainlit
|
| 25 |
COPY --chown=user chainlit.md ./
|
| 26 |
+
COPY --chown=user requirements.txt ./
|
| 27 |
|
| 28 |
+
# Install dependencies
|
| 29 |
+
RUN pip install -r requirements.txt
|
| 30 |
|
| 31 |
+
EXPOSE 8000
|
|
|
|
| 32 |
|
| 33 |
+
# Run Chainlit with proper host binding
|
| 34 |
+
CMD ["chainlit", "run", "app/spark.py", "--host", "0.0.0.0", "--port", "8000"]
|