mirror of
https://github.com/reconurge/flowsint.git
synced 2026-03-11 17:34:31 -05:00
feat: upgrade deploy to use docker only
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
# --- Production stage ---
|
||||
FROM python:3.12-slim AS prod
|
||||
# --- Base stage with Python 3.12 ---
|
||||
FROM python:3.12-slim AS base
|
||||
|
||||
# Environment variables
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
ENV POETRY_VIRTUALENVS_CREATE=false
|
||||
ENV APP_ENV=prod
|
||||
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
curl \
|
||||
git \
|
||||
libpq-dev \
|
||||
pkg-config \
|
||||
libcairo2-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Poetry
|
||||
@@ -19,17 +21,50 @@ RUN curl -sSL https://install.python-poetry.org | python3 - \
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy only dependency files to leverage Docker cache
|
||||
COPY pyproject.toml poetry.lock ./
|
||||
# --- Development stage ---
|
||||
FROM base AS dev
|
||||
|
||||
# Install production dependencies only (no dev)
|
||||
RUN poetry install --no-dev --no-root
|
||||
ENV APP_ENV=development
|
||||
|
||||
# Copy the source code
|
||||
COPY . .
|
||||
# Copy all dependency packages
|
||||
COPY flowsint-core /app/flowsint-core
|
||||
COPY flowsint-types /app/flowsint-types
|
||||
COPY flowsint-transforms /app/flowsint-transforms
|
||||
|
||||
# Copy API files
|
||||
COPY flowsint-api /app/flowsint-api
|
||||
|
||||
WORKDIR /app/flowsint-api
|
||||
|
||||
# Install dependencies with dev packages
|
||||
RUN poetry install --no-root
|
||||
|
||||
# Expose FastAPI port
|
||||
EXPOSE 5001
|
||||
|
||||
# Run FastAPI
|
||||
ENTRYPOINT ["/app/flowsint-api/entrypoint.sh"]
|
||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "5001", "--reload"]
|
||||
|
||||
# --- Production stage ---
|
||||
FROM base AS prod
|
||||
|
||||
ENV APP_ENV=production
|
||||
|
||||
# Copy all dependency packages
|
||||
COPY flowsint-core /app/flowsint-core
|
||||
COPY flowsint-types /app/flowsint-types
|
||||
COPY flowsint-transforms /app/flowsint-transforms
|
||||
|
||||
# Copy API files
|
||||
COPY flowsint-api /app/flowsint-api
|
||||
|
||||
WORKDIR /app/flowsint-api
|
||||
|
||||
# Install production dependencies only (no dev)
|
||||
RUN poetry install
|
||||
|
||||
# Expose FastAPI port
|
||||
EXPOSE 5001
|
||||
|
||||
ENTRYPOINT ["/app/flowsint-api/entrypoint.sh"]
|
||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "5001"]
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
#!/bin/sh
|
||||
set -e # Arrêter le script en cas d'erreur
|
||||
set -e
|
||||
|
||||
if [ "$1" = "app" ]; then
|
||||
echo "Démarrage de FastAPI..."
|
||||
exec uvicorn app.main:app --host 0.0.0.0 --port 5001
|
||||
elif [ "$1" = "celery" ]; then
|
||||
echo "Démarrage de Celery..."
|
||||
exec celery -A app.core.celery worker --loglevel=info
|
||||
else
|
||||
exec "$@"
|
||||
fi
|
||||
echo "Running database migrations..."
|
||||
alembic upgrade head
|
||||
|
||||
echo "Starting application..."
|
||||
exec "$@"
|
||||
|
||||
Reference in New Issue
Block a user