Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +12 -6
Dockerfile
CHANGED
@@ -40,10 +40,16 @@ COPY --from=builder /usr/local /usr/local
|
|
40 |
# Copy the rest of the backend files to the container
|
41 |
COPY ./ .
|
42 |
|
43 |
-
#
|
44 |
-
RUN
|
45 |
-
&& chown -R postgres:postgres /usr/local/pgsql/data \
|
46 |
-
&& su -c "/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data" postgres
|
47 |
|
48 |
-
#
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 && /usr/local/pgsql/bin/pg_ctl start -D /usr/local/pgsql/data -l logfile &
|
|
|
|
|
45 |
|
46 |
+
# Install additional Python dependencies
|
47 |
+
RUN pip install -U -q pyngrok ipython psycopg2 alembic
|
48 |
+
|
49 |
+
# Create PostgreSQL users and databases in the background
|
50 |
+
RUN su -c "psql -c \"CREATE USER postadmin WITH PASSWORD 'postpass';\"" postgres &
|
51 |
+
RUN su -c "psql -c \"CREATE DATABASE siksalaya;\"" postgres &
|
52 |
+
RUN su -c "psql -c \"GRANT ALL PRIVILEGES ON DATABASE sikshyalaya TO postadmin;\"" postgres &
|
53 |
+
|
54 |
+
# Start the FastAPI app using Uvicorn
|
55 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|