hamza82 commited on
Commit
8f0bd30
·
verified ·
1 Parent(s): 52f77d6

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -15
Dockerfile CHANGED
@@ -1,22 +1,22 @@
1
- # Use an official Python runtime as a parent image
2
- FROM python:3.8-slim
3
 
4
  # Set the working directory in the container
5
- WORKDIR /usr/src/app
6
 
7
- # Copy the current directory contents into the container at /usr/src/app
8
- COPY . .
9
 
10
  # Install any needed packages specified in requirements.txt
11
- RUN pip install --no-cache-dir flask gunicorn
 
12
 
13
- # Expose the ports the app runs on
14
- EXPOSE 8080 8000
15
 
16
- # Install Node.js for serving the static site and npm to install http-server
17
- RUN apt-get update && \
18
- apt-get install -y nodejs npm && \
19
- npm install -g http-server
20
- RUN pip install flask_cors
21
- # Command to run the Flask app using Gunicorn on port 8000
22
- CMD gunicorn -b :8000 app:app & http-server ./static -p 8080
 
1
+ # Use an official Python runtime as a base image
2
+ FROM python:3.9-slim
3
 
4
  # Set the working directory in the container
5
+ WORKDIR /app
6
 
7
+ # Copy the current directory contents into the container
8
+ COPY . /app
9
 
10
  # Install any needed packages specified in requirements.txt
11
+ COPY requirements.txt /app/
12
+ RUN pip install --no-cache-dir -r requirements.txt
13
 
14
+ # Make port 8000 available to the world outside this container
15
+ EXPOSE 8080
16
 
17
+ # Define environment variable
18
+ ENV UVICORN_HOST=0.0.0.0
19
+ ENV UVICORN_PORT=8000
20
+
21
+ # Run the application
22
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8080"]