ashwinR commited on
Commit
e2a3c25
1 Parent(s): 542933f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -4
Dockerfile CHANGED
@@ -37,8 +37,10 @@ COPY --from=builder /usr/local /usr/local
37
  # Copy the rest of the backend files to the container
38
  COPY ./ .
39
 
40
- # Expose the backend port (change this if your FastAPI app uses a different port)
41
- EXPOSE 7860
 
 
42
 
43
- # Start Redis server and the FastAPI app using Uvicorn
44
- CMD ["bash", "-c", "sudo service redis-server start && sudo pg_ctl start -D /usr/local/pgsql/data -l logfile && uvicorn app:app --host 0.0.0.0 --port 7860"]
 
37
  # Copy the rest of the backend files to the container
38
  COPY ./ .
39
 
40
+ # Initialize PostgreSQL data directory and set permissions
41
+ RUN mkdir -p /usr/local/pgsql/data \
42
+ && chown -R postgres:postgres /usr/local/pgsql/data \
43
+ && su -c "/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data" postgres
44
 
45
+ # Start Redis server and PostgreSQL
46
+ CMD ["bash", "-c", "redis-server --daemonize yes && su -c '/usr/local/pgsql/bin/pg_ctl start -D /usr/local/pgsql/data -l logfile' postgres && uvicorn app:app --host 0.0.0.0 --port 7860"]