FROM rasa/duckling RUN apt update && \ apt install -y wget curl git build-essential libssl-dev zlib1g-dev libbz2-dev \ libreadline-dev libsqlite3-dev libncurses5-dev libffi-dev liblzma-dev libncursesw5-dev \ xz-utils tk-dev supervisor software-properties-common RUN add-apt-repository contrib && \ add-apt-repository non-free && \ apt update && \ apt install -y unrar # Install pyenv RUN curl https://pyenv.run | bash # Set up pyenv environment variables ENV PYENV_ROOT="/root/.pyenv" ENV PATH="$PYENV_ROOT/bin:$PATH" RUN echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc && \ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc && \ echo 'eval "$(pyenv init --path)"' >> ~/.bashrc && \ echo 'eval "$(pyenv init -)"' >> ~/.bashrc && \ echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc # Install Python 3.10 using pyenv RUN pyenv install 3.10.12 && \ pyenv global 3.10.12 WORKDIR /app COPY ./requirements.txt . RUN pyenv exec python3 -m venv /app/venv RUN /app/venv/bin/pip install --no-cache-dir --upgrade pip RUN /app/venv/bin/pip install --no-cache-dir -r requirements.txt COPY ./src/ ./src COPY ./ckpt/ ./ckpt ENV API_HOST=0.0.0.0 ENV API_PORT=80 ENV MODEL_TYPE=duckling_operator ENV DUCKLING_HOST=localhost ENV DUCKLING_PORT=8000 ENV OPERATOR_MODEL_TYPE=bert ENV DEVICE=cpu # Create a supervisord configuration file RUN mkdir -p /etc/supervisor/conf.d COPY ./supervisord.conf /etc/supervisor/conf.d/supervisord.conf # Expose the necessary ports EXPOSE 80 # Start supervisord to run both FastAPI and Duckling CMD ["/usr/bin/supervisord"]