velmurugan1122 commited on
Commit
24f8ca4
·
verified ·
1 Parent(s): 8196089

Upload Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -10
Dockerfile CHANGED
@@ -12,17 +12,13 @@ RUN pip install --no-cache-dir --upgrade pip \
12
  # Copy remaining application code
13
  COPY . /app
14
 
15
- # Create necessary directories with appropriate permissions
16
- RUN mkdir -p /app/logs /app/.cache/huggingface \
17
- && chmod -R 777 /app/logs /app/.cache/huggingface
18
-
19
- RUN mkdir -p /app/back_end/data && chmod 775 /app/back_end/data
20
 
21
  # Set SQLite permissions and initialize database
22
  RUN python -c "import sqlite3; conn = sqlite3.connect('/app/back_end/data/veludb.db'); \
23
  conn.execute('CREATE TABLE IF NOT EXISTS chatbot_responses (prompt TEXT, response TEXT)'); conn.close()" \
24
- && chown -R 1000:1000 /app/back_end/data/veludb.db \
25
- && chmod 664 /app/back_end/data/veludb.db
26
 
27
  # Install additional dependencies
28
  RUN apt-get update && apt-get install -y tmux
@@ -36,7 +32,14 @@ ENV PYTHONPATH="/app/"
36
  # Expose ports for FastAPI (8000) and Streamlit (7860)
37
  EXPOSE 8000 7860
38
 
 
 
 
 
 
39
  # Start FastAPI and Streamlit correctly
40
- CMD ["sh", "-c", "tmux new-session -d 'uvicorn back_end.application.main:app --host 0.0.0.0 --port 8000' && \
41
- sleep 5 && \
42
- streamlit run front_end/app.py --server.port 7860 --server.address 0.0.0.0"]
 
 
 
12
  # Copy remaining application code
13
  COPY . /app
14
 
15
+ # Create necessary directories with correct permissions
16
+ RUN mkdir -p /app/back_end/data && chmod -R 777 /app/back_end/data
 
 
 
17
 
18
  # Set SQLite permissions and initialize database
19
  RUN python -c "import sqlite3; conn = sqlite3.connect('/app/back_end/data/veludb.db'); \
20
  conn.execute('CREATE TABLE IF NOT EXISTS chatbot_responses (prompt TEXT, response TEXT)'); conn.close()" \
21
+ && chmod 777 /app/back_end/data/veludb.db
 
22
 
23
  # Install additional dependencies
24
  RUN apt-get update && apt-get install -y tmux
 
32
  # Expose ports for FastAPI (8000) and Streamlit (7860)
33
  EXPOSE 8000 7860
34
 
35
+ # Set correct user permissions
36
+ USER root
37
+ RUN chown -R 1000:1000 /app/back_end/data
38
+ USER 1000
39
+
40
  # Start FastAPI and Streamlit correctly
41
+ CMD ["sh", "-c", "ls -lah /app/back_end/data && \
42
+ python -c 'import sqlite3; print(sqlite3.connect(\"/app/back_end/data/veludb.db\"))' && \
43
+ tmux new-session -d 'uvicorn back_end.application.main:app --host 0.0.0.0 --port 8000' && \
44
+ sleep 5 && \
45
+ streamlit run front_end/app.py --server.port 7860 --server.address 0.0.0.0"]