boyinfuture commited on
Commit
5eed863
·
1 Parent(s): 48fbd5e

adding the dockerfile for backend deployment

Browse files
backend/Dockerfile CHANGED
@@ -14,6 +14,28 @@
14
 
15
 
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  FROM python:3.11-slim
18
 
19
  WORKDIR /code
@@ -21,11 +43,15 @@ WORKDIR /code
21
  RUN apt-get update && apt-get install -y git
22
 
23
  COPY ./backend/requirements.txt .
24
- RUN pip install --no-cache-dir --upgrade -r requirements.txt
 
 
25
 
26
  COPY ./ml_models /code/sentiment_model
27
 
28
- WORKDIR /code/app
 
29
 
30
- # This is the default command for our web server
31
- CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "10000"]
 
 
14
 
15
 
16
 
17
+ # FROM python:3.11-slim
18
+
19
+ # WORKDIR /code
20
+
21
+ # RUN apt-get update && apt-get install -y git
22
+
23
+ # COPY ./backend/requirements.txt .
24
+ # RUN pip install --no-cache-dir --upgrade -r requirements.txt
25
+
26
+ # COPY ./ml_models /code/sentiment_model
27
+
28
+ # WORKDIR /code/app
29
+
30
+ # # This is the default command for our web server
31
+ # CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "10000"]
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
  FROM python:3.11-slim
40
 
41
  WORKDIR /code
 
43
  RUN apt-get update && apt-get install -y git
44
 
45
  COPY ./backend/requirements.txt .
46
+ # Install Gunicorn for a production-ready server
47
+ RUN pip install gunicorn
48
+ RUN pip install --no-cache-dir -r requirements.txt
49
 
50
  COPY ./ml_models /code/sentiment_model
51
 
52
+ # Copy the application code last
53
+ COPY ./backend .
54
 
55
+ # This CMD will be used by the web service on Railway.
56
+ # It uses the $PORT variable that Railway provides automatically.
57
+ CMD ["gunicorn", "-w", "2", "-k", "uvicorn.workers.UvicornWorker", "main:app", "--bind", "0.0.0.0:${PORT}"]
backend/__pycache__/celery_worker.cpython-311.pyc CHANGED
Binary files a/backend/__pycache__/celery_worker.cpython-311.pyc and b/backend/__pycache__/celery_worker.cpython-311.pyc differ
 
backend/__pycache__/main.cpython-311.pyc CHANGED
Binary files a/backend/__pycache__/main.cpython-311.pyc and b/backend/__pycache__/main.cpython-311.pyc differ
 
backend/__pycache__/schemas.cpython-311.pyc CHANGED
Binary files a/backend/__pycache__/schemas.cpython-311.pyc and b/backend/__pycache__/schemas.cpython-311.pyc differ
 
backend/core/__pycache__/config.cpython-311.pyc CHANGED
Binary files a/backend/core/__pycache__/config.cpython-311.pyc and b/backend/core/__pycache__/config.cpython-311.pyc differ
 
backend/core/__pycache__/database.cpython-311.pyc CHANGED
Binary files a/backend/core/__pycache__/database.cpython-311.pyc and b/backend/core/__pycache__/database.cpython-311.pyc differ
 
backend/models/__pycache__/analysis_job.cpython-311.pyc CHANGED
Binary files a/backend/models/__pycache__/analysis_job.cpython-311.pyc and b/backend/models/__pycache__/analysis_job.cpython-311.pyc differ
 
backend/tools/__pycache__/data_tools.cpython-311.pyc CHANGED
Binary files a/backend/tools/__pycache__/data_tools.cpython-311.pyc and b/backend/tools/__pycache__/data_tools.cpython-311.pyc differ
 
backend/tools/__pycache__/news_tools.cpython-311.pyc CHANGED
Binary files a/backend/tools/__pycache__/news_tools.cpython-311.pyc and b/backend/tools/__pycache__/news_tools.cpython-311.pyc differ