embedding / Dockerfile
nam pham
chore: change port expose
3c77fc1
raw
history blame contribute delete
916 Bytes
ARG PYTHON_VERSION=3.12
FROM python:$PYTHON_VERSION-slim as builder
RUN pip install poetry==1.8.2
ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache
WORKDIR /app
COPY pyproject.toml poetry.lock ./
RUN poetry install --no-root && rm -rf $POETRY_CACHE_DIR
FROM python:$PYTHON_VERSION-slim as runtime
####### Add your own installation commands here #######
# RUN pip install some-package
# RUN wget https://path/to/some/data/or/weights
# RUN apt-get update && apt-get install -y <package-name>
RUN mkdir -p /app/cache && chmod 777 /app/cache
RUN useradd -m -u 1000 user
COPY . /app
RUN chown -R user:user /app
USER user
ENV VIRTUAL_ENV=/app/.venv \
PATH="/app/.venv/bin:$PATH"
COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}
# Install litserve and requirements
EXPOSE 7860
CMD ["sh", "/app/bin/start-api.sh"]