Spaces:
Build error
Build error
File size: 1,721 Bytes
7ce49a9 b7a7f32 63f7409 b7a7f32 7ce49a9 63f7409 7ce49a9 b7a7f32 7ce49a9 b7a7f32 7ce49a9 bc24947 58633f0 7ce49a9 63f7409 c43171c 640392a 7ce49a9 b7a7f32 7ce49a9 b7a7f32 1de79ab 6f0319c 1de79ab 4565280 1979bc2 109da6a 1f78db7 4565280 bb57f2b 1de79ab bb57f2b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
FROM python:3.9-slim AS builder
WORKDIR /app
COPY ./pyproject.toml .
COPY ./poetry.lock .
# Install build dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential \
&& pip install --upgrade pip poetry \
&& poetry config virtualenvs.create false \
&& poetry install --no-interaction --no-ansi
FROM python:3.9-slim
WORKDIR /app
# Install runtime dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends libpq5 redis-server \
&& apt-get install -y postgresql \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install PostgreSQL client
RUN apt-get update \
&& apt-get install -y --no-install-recommends postgresql-client \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Switch to the root user
USER root
# Copy the built virtual environment from the builder stage
COPY --from=builder /usr/local /usr/local
# Copy the rest of the backend files to the container
COPY ./ .
# Install additional Python dependencies
#RUN pip install -U -q pyngrok ipython psycopg2 alembic
# Create PostgreSQL users and databases in the background
RUN service redis-server start \
&& service postgresql start
#RUN pg_ctl start -D /usr/local/pgsql/data -l logfile \
# && psql -c "CREATE USER postadmin WITH PASSWORD 'postpass';" \
# && psql -c "CREATE DATABASE siksalaya;" \
# && psql -c "GRANT ALL PRIVILEGES ON DATABASE siksalaya TO postadmin;" \
# && pg_ctl stop -D /usr/local/pgsql/data
RUN alembic revision --autogenerate -m "migrations"
RUN alembic upgrade head
# Start the FastAPI app using Uvicorn
CMD ["bash", "-c", "redis-server --daemonize yes && uvicorn app:app --host 0.0.0.0 --port 7860"]
|