Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +7 -5
Dockerfile
CHANGED
@@ -19,6 +19,7 @@ WORKDIR /app
|
|
19 |
# Install runtime dependencies
|
20 |
RUN apt-get update \
|
21 |
&& apt-get install -y --no-install-recommends libpq5 redis-server \
|
|
|
22 |
&& apt-get clean \
|
23 |
&& rm -rf /var/lib/apt/lists/*
|
24 |
|
@@ -40,8 +41,6 @@ COPY --from=builder /usr/local /usr/local
|
|
40 |
# Copy the rest of the backend files to the container
|
41 |
COPY ./ .
|
42 |
|
43 |
-
# Start Redis server and PostgreSQL in the background
|
44 |
-
RUN service redis-server start
|
45 |
|
46 |
# Switch back to a non-root user for security
|
47 |
USER appuser
|
@@ -50,9 +49,12 @@ USER appuser
|
|
50 |
#RUN pip install -U -q pyngrok ipython psycopg2 alembic
|
51 |
|
52 |
# Create PostgreSQL users and databases in the background
|
53 |
-
RUN
|
54 |
-
|
55 |
-
|
|
|
|
|
|
|
56 |
|
57 |
# Start the FastAPI app using Uvicorn
|
58 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
19 |
# Install runtime dependencies
|
20 |
RUN apt-get update \
|
21 |
&& apt-get install -y --no-install-recommends libpq5 redis-server \
|
22 |
+
&& apt-get install postgresql
|
23 |
&& apt-get clean \
|
24 |
&& rm -rf /var/lib/apt/lists/*
|
25 |
|
|
|
41 |
# Copy the rest of the backend files to the container
|
42 |
COPY ./ .
|
43 |
|
|
|
|
|
44 |
|
45 |
# Switch back to a non-root user for security
|
46 |
USER appuser
|
|
|
49 |
#RUN pip install -U -q pyngrok ipython psycopg2 alembic
|
50 |
|
51 |
# Create PostgreSQL users and databases in the background
|
52 |
+
RUN service redis-server start \
|
53 |
+
&& service postgresql start \
|
54 |
+
&& sudo -u postgres psql -c "CREATE USER postadmin WITH PASSWORD 'postpass';" \
|
55 |
+
&& sudo -u postgres psql -c "CREATE DATABASE siksalaya;" \
|
56 |
+
&& sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE sikshyalaya TO postadmin;"
|
57 |
+
|
58 |
|
59 |
# Start the FastAPI app using Uvicorn
|
60 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|