Vivek0912 commited on
Commit
fa4266d
·
1 Parent(s): fe6855c

added docker

Browse files
Files changed (3) hide show
  1. .dockerignore +27 -0
  2. Dockerfile +28 -0
  3. backend/Dockerfile +0 -17
.dockerignore ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ **/__pycache__
2
+ **/.venv
3
+ **/.classpath
4
+ **/.dockerignore
5
+ **/.env
6
+ **/.git
7
+ **/.gitignore
8
+ **/.project
9
+ **/.settings
10
+ **/.toolstarget
11
+ **/.vs
12
+ **/.vscode
13
+ **/*.*proj.user
14
+ **/*.dbmdl
15
+ **/*.jfm
16
+ **/bin
17
+ **/charts
18
+ **/docker-compose*
19
+ **/compose*
20
+ **/Dockerfile*
21
+ **/node_modules
22
+ **/npm-debug.log
23
+ **/obj
24
+ **/secrets.dev.yaml
25
+ **/values.dev.yaml
26
+ LICENSE
27
+ README.md
Dockerfile ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Use the official Python 3.11.5 image
3
+ FROM python:3.11.5
4
+
5
+ # Expose FastAPI port
6
+ EXPOSE 7860
7
+
8
+ # Keeps Python from generating .pyc files in the container
9
+ ENV PYTHONDONTWRITEBYTECODE=1
10
+
11
+ # Turns off buffering for easier logging
12
+ ENV PYTHONUNBUFFERED=1
13
+
14
+ # Set working directory inside the backend folder
15
+ WORKDIR /app
16
+
17
+ # Copy only the backend folder
18
+ COPY backend/ /app/
19
+
20
+ # Install dependencies from the backend folder
21
+ RUN python -m pip install --no-cache-dir -r requirements.txt
22
+
23
+ # Create a non-root user with permission to access /app
24
+ RUN adduser -u 5678 --disabled-password --gecos "" --home /app appuser && chown -R appuser /app
25
+ USER appuser
26
+
27
+ # Start FastAPI with Gunicorn & Uvicorn worker
28
+ CMD ["gunicorn", "--bind", "0.0.0.0:7860", "-k", "uvicorn.workers.UvicornWorker", "main:app"]
backend/Dockerfile DELETED
@@ -1,17 +0,0 @@
1
- # Use the official Python 3.11.5 image
2
- FROM python:3.11.5
3
-
4
- # Set the working directory
5
- WORKDIR /app
6
-
7
- # Copy the backend folder into the container
8
- COPY backend /app
9
-
10
- # Install dependencies
11
- RUN pip install --no-cache-dir -r requirements.txt
12
-
13
- # Expose the port FastAPI runs on
14
- EXPOSE 7860
15
-
16
- # Run FastAPI app
17
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]