Ezhil commited on
Commit
76647ec
Β·
1 Parent(s): 45ce216

backend deployment

Browse files
Files changed (2) hide show
  1. Dockerfile +9 -13
  2. README.md +6 -5
Dockerfile CHANGED
@@ -1,24 +1,20 @@
1
- # Use an official Python runtime as a parent image
2
- FROM python:3.9
3
 
4
- RUN useradd -m -u 1000 user
5
-
6
- USER user
7
-
8
- ENV PATH="/home/user/.local/bin:$PATH"
9
-
10
- # Set the working directory in the container
11
  WORKDIR /app
12
 
13
- COPY --chown=user ./requirements.txt requirements.txt
 
14
 
15
  # Install dependencies
16
- RUN pip install --no-cache-dir -r requirements.txt
17
 
18
- # Expose the ports for FastAPI (8000) and Streamlit (8501)
19
 
20
- COPY --chown=user . /app
 
21
 
 
22
  # Run FastAPI and Streamlit in parallel
23
  CMD ["uvicorn" ,"api.main:app","--host" ,"0.0.0.0", "--port", "7860"]
24
 
 
1
+ FROM python:3.11
 
2
 
3
+ # Set the working directory inside the container
 
 
 
 
 
 
4
  WORKDIR /app
5
 
6
+ # Copy all project files into the container
7
+ COPY . /app
8
 
9
  # Install dependencies
10
+ RUN pip install --upgrade pip
11
 
12
+ RUN mkdir -p /app/logs && chmod -R 777 /app/logs
13
 
14
+ # Install any needed packages specified in requirements.txt
15
+ RUN pip install --no-cache-dir -r requirements.txt
16
 
17
+ EXPOSE 7860
18
  # Run FastAPI and Streamlit in parallel
19
  CMD ["uvicorn" ,"api.main:app","--host" ,"0.0.0.0", "--port", "7860"]
20
 
README.md CHANGED
@@ -1,10 +1,11 @@
1
  ---
2
- title: Backend
3
- emoji: πŸ‘
4
- colorFrom: yellow
5
- colorTo: green
6
  sdk: docker
7
- app_file: Dockerfile
8
  pinned: false
9
  ---
10
 
 
 
 
1
  ---
2
+ title: World Population FastAPI
3
+ emoji: πŸ‘€
4
+ colorFrom: pink
5
+ colorTo: gray
6
  sdk: docker
 
7
  pinned: false
8
  ---
9
 
10
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
11
+