Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +10 -19
Dockerfile
CHANGED
@@ -18,8 +18,6 @@ WORKDIR /app
|
|
18 |
|
19 |
# Install runtime dependencies
|
20 |
RUN apt-get update \
|
21 |
-
&& apt-get install -y --no-install-recommends libpq5 redis-server \
|
22 |
-
&& apt-get install -y postgresql \
|
23 |
&& apt-get clean \
|
24 |
&& rm -rf /var/lib/apt/lists/*
|
25 |
|
@@ -38,28 +36,21 @@ COPY --from=builder /usr/local /usr/local
|
|
38 |
# Copy the rest of the backend files to the container
|
39 |
COPY ./ .
|
40 |
|
41 |
-
|
42 |
-
|
43 |
|
44 |
-
|
45 |
-
#RUN service redis-server start \
|
46 |
-
# && service postgresql start
|
47 |
-
RUN apt-get update && apt-get install -y supervisor redis-server postgresql
|
48 |
|
49 |
-
#
|
50 |
-
|
51 |
|
52 |
-
#
|
53 |
-
|
|
|
|
|
54 |
|
|
|
55 |
|
56 |
-
#RUN pg_ctl start -D /usr/local/pgsql/data -l logfile \
|
57 |
-
# && psql -c "CREATE USER postadmin WITH PASSWORD 'postpass';" \
|
58 |
-
# && psql -c "CREATE DATABASE siksalaya;" \
|
59 |
-
# && psql -c "GRANT ALL PRIVILEGES ON DATABASE siksalaya TO postadmin;" \
|
60 |
-
# && pg_ctl stop -D /usr/local/pgsql/data
|
61 |
-
|
62 |
-
RUN alembic revision --autogenerate -m "migrations"
|
63 |
RUN alembic upgrade head
|
64 |
# Start the FastAPI app using Uvicorn
|
65 |
CMD ["bash", "-c", "redis-server --daemonize yes && uvicorn app:app --host 0.0.0.0 --port 7860"]
|
|
|
18 |
|
19 |
# Install runtime dependencies
|
20 |
RUN apt-get update \
|
|
|
|
|
21 |
&& apt-get clean \
|
22 |
&& rm -rf /var/lib/apt/lists/*
|
23 |
|
|
|
36 |
# Copy the rest of the backend files to the container
|
37 |
COPY ./ .
|
38 |
|
39 |
+
FROM redis:latest AS redis
|
40 |
+
RUN redis-server
|
41 |
|
42 |
+
FROM postgres:latest
|
|
|
|
|
|
|
43 |
|
44 |
+
# Start Postgres
|
45 |
+
RUN pg_ctl -D /usr/local/pgsql/data start
|
46 |
|
47 |
+
# Create user, database, and grant privileges
|
48 |
+
RUN psql -U postgres -c "CREATE USER postadmin WITH PASSWORD 'postpass';"
|
49 |
+
RUN psql -U postgres -c "CREATE DATABASE siksalaya;"
|
50 |
+
RUN psql -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE siksalaya TO postadmin;"
|
51 |
|
52 |
+
ENV DATABASE_URL=postgresql://postadmin:postpass@localhost/siksalaya
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
RUN alembic upgrade head
|
55 |
# Start the FastAPI app using Uvicorn
|
56 |
CMD ["bash", "-c", "redis-server --daemonize yes && uvicorn app:app --host 0.0.0.0 --port 7860"]
|