refactor(Dockerfile): simplify Dockerfile by removing unused build stages and dependencies
feat(Dockerfile): add user to container and set working directory to user's home directory feat(Dockerfile): install langflow package and set CMD to run langflow with specified host and port
This commit is contained in:
parent
397ff12760
commit
31affc743e
1 changed files with 10 additions and 55 deletions
65
Dockerfile
65
Dockerfile
|
|
@ -1,59 +1,14 @@
|
|||
# FROM logspace/backend_build as backend_build
|
||||
FROM logspace/frontend_build as frontend_build
|
||||
FROM python:3.10-slim
|
||||
|
||||
# `python-base` sets up all our shared environment variables
|
||||
FROM python:3.10-slim as langflow_build
|
||||
RUN apt-get update && apt-get install gcc g++ git make -y
|
||||
RUN useradd -m -u 1000 user
|
||||
USER user
|
||||
ENV HOME=/home/user \
|
||||
PATH=/home/user/.local/bin:$PATH
|
||||
|
||||
# python
|
||||
ENV PYTHONUNBUFFERED=1 \
|
||||
# prevents python creating .pyc files
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
\
|
||||
# pip
|
||||
PIP_NO_CACHE_DIR=off \
|
||||
PIP_DISABLE_PIP_VERSION_CHECK=on \
|
||||
PIP_DEFAULT_TIMEOUT=100 \
|
||||
\
|
||||
# poetry
|
||||
# https://python-poetry.org/docs/configuration/#using-environment-variables
|
||||
POETRY_VERSION=1.4.0 \
|
||||
# make poetry install to this location
|
||||
POETRY_HOME="/opt/poetry" \
|
||||
# make poetry create the virtual environment in the project's root
|
||||
# it gets named `.venv`
|
||||
POETRY_VIRTUALENVS_IN_PROJECT=true \
|
||||
# do not ask any interactive question
|
||||
POETRY_NO_INTERACTION=1 \
|
||||
\
|
||||
# paths
|
||||
# this is where our requirements + virtual environment will live
|
||||
PYSETUP_PATH="/opt/pysetup" \
|
||||
VENV_PATH="/opt/pysetup/.venv"
|
||||
WORKDIR $HOME/app
|
||||
|
||||
# prepend poetry and venv to path
|
||||
ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH"
|
||||
COPY --chown=user . $HOME/app
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install --no-install-recommends -y \
|
||||
# deps for installing poetry
|
||||
curl \
|
||||
# deps for building python deps
|
||||
build-essential libpq-dev git
|
||||
|
||||
# install poetry - respects $POETRY_VERSION & $POETRY_HOME
|
||||
# RUN curl -sSL https://install.python-poetry.org | python3 -
|
||||
|
||||
# copy project requirement files here to ensure they will be cached.
|
||||
WORKDIR /app
|
||||
COPY pyproject.toml ./
|
||||
# copy langflow
|
||||
COPY ./langflow ./langflow
|
||||
|
||||
# Copy files from frontend
|
||||
COPY --from=frontend_build /app/build /app/src/frontend/build/
|
||||
|
||||
RUN pip install .
|
||||
|
||||
EXPOSE 5003
|
||||
|
||||
CMD [ "langflow" ]
|
||||
RUN pip install langflow>==0.0.71 -U --user
|
||||
CMD ["langflow", "--host", "0.0.0.0", "--port", "7860"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue