|
|
|
|
|
|
|
FROM python:3.12-slim-bullseye AS deps |
|
|
|
ENV POETRY_VERSION 1.5.1 |
|
|
|
RUN apt-get update && apt-get install --no-install-recommends -y \ |
|
gcc \ |
|
libc-dev \ |
|
libpq-dev \ |
|
libpq5 \ |
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
WORKDIR /tmp |
|
COPY ./pyproject.toml /tmp |
|
|
|
RUN pip install --no-cache-dir email-validator==2.1.0 |
|
COPY requirements.txt . |
|
RUN pip install --no-cache-dir -r requirements.txt |
|
RUN pip install -q --no-cache-dir poetry==$POETRY_VERSION \ |
|
&& poetry lock -q -n \ |
|
&& poetry export -f requirements.txt -o /tmp/requirements.txt --without-hashes \ |
|
&& pip uninstall -y poetry \ |
|
&& pip install --no-cache-dir -q -r /tmp/requirements.txt |
|
|
|
|
|
|
|
|
|
FROM python:3.12-slim-bullseye AS base |
|
|
|
ENV APP_NAME MailPilot_ai_agents |
|
ENV PREFIX /opt/MailPilot |
|
ENV PREFIX_APP ${PREFIX}/${APP_NAME} |
|
|
|
ENV PYTHONUNBUFFERED 1 |
|
|
|
RUN groupadd -g 20001 MailPilot \ |
|
&& useradd -l -M -u 10001 -g MailPilot MailPilot |
|
|
|
WORKDIR /opt/MailPilot/MailPilot_ai_agents |
|
|
|
|
|
COPY ./app ./app |
|
|
|
|
|
RUN chmod -R 755 /opt/MailPilot/MailPilot_ai_agents |
|
|
|
COPY ./docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh |
|
RUN chmod +x /usr/local/bin/docker-entrypoint.sh |
|
|
|
RUN apt-get update && apt-get install --no-install-recommends -y libpq5 postgresql-client \ |
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
COPY --from=deps /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages |
|
COPY --from=deps /usr/local/bin /usr/local/bin |
|
COPY . ${PREFIX_APP} |
|
|
|
RUN chown -R MailPilot:MailPilot ${PREFIX_APP} |
|
|
|
|
|
EXPOSE 7860 |
|
ENV UVICORN_PORT=7860 |
|
ENV UVICORN_HOST=0.0.0.0 |
|
|
|
USER MailPilot |
|
|
|
CMD ["uvicorn", "app.main:fastapi_app", "--host", "0.0.0.0", "--port", "7860"] |