muryshev commited on
Commit
8db6a4c
·
1 Parent(s): 7c28e1f

dockerfile

Browse files
Files changed (2) hide show
  1. .gitignore +1 -1
  2. Dockerfile +45 -0
.gitignore CHANGED
@@ -5,4 +5,4 @@ __pycache__
5
  .nv
6
  *.bash_history
7
  *.zip
8
- /Dockerfile
 
5
  .nv
6
  *.bash_history
7
  *.zip
8
+ .env
Dockerfile ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use an official Python runtime as a parent image
2
+ FROM python:3.10-slim-bullseye
3
+
4
+ # Set Python to use unbuffered mode
5
+ ENV PYTHONUNBUFFERED=1
6
+
7
+ ENV PATH="/var/www/.local/bin:${PATH}"
8
+
9
+ # Create a non-root user
10
+ RUN useradd -m -u 1000 -U -s /bin/bash myuser
11
+
12
+ # Install dependencies
13
+ RUN apt-get update && \
14
+ apt-get install -y --no-install-recommends python3-pip python3-dev && \
15
+ rm -rf /var/lib/apt/lists/*
16
+
17
+ # Set the working directory in the container
18
+ RUN mkdir /var/www
19
+ ENV HOME=/var/www
20
+ WORKDIR /var/www
21
+
22
+ # Change ownership of /var/www to the non-root user
23
+ RUN chown -R myuser:myuser /var/www
24
+
25
+ # Switch to the non-root user
26
+ USER myuser
27
+
28
+ # Copy the current directory contents into the container at /var/www
29
+ COPY . /var/www
30
+
31
+ # Install Python dependencies
32
+ RUN pip install --user -r requirements.txt
33
+
34
+ # Expose the port
35
+ EXPOSE 7860
36
+
37
+ RUN mkdir /var/www/logs
38
+
39
+ # Set environment variables
40
+ ENV MODEL_PATH="BAAI/bge-m3" \
41
+ DEVICE="cpu" \
42
+ APP_PORT=7860
43
+
44
+ # Run fastapi_app.py when the container launches
45
+ CMD python3 -m uvicorn app:app --host=0.0.0.0 --port=APP_PORT