Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Commit

Permalink
Update Dockerfile and .dockerignore***
Browse files Browse the repository at this point in the history
***Add slim version of Python base image in Dockerfile***

***Copy requirements.txt to the working directory in Dockerfile***

***Install dependencies in Dockerfile***

***Copy the rest of the application code to the working directory in Dockerfile***

***Expose port 8000 in Dockerfile***

***Change command to run the application using Uvicorn in Dockerfile***

***Update .dockerignore to include 'cloud' directory
  • Loading branch information
DeepeshKalura committed Feb 10, 2024
1 parent 1c7af48 commit ce7ed87
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
4 changes: 3 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ client_secret.json

.firebaserc

firebase.json
firebase.json

cloud
23 changes: 11 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
# Use the official Python image as the base image
FROM python:3.11.5
FROM python:3.11.5-slim

# Set the working directory inside the container
WORKDIR /app

# Copy the requirements.txt file into the container at /app
COPY requirements.txt /app/
# Copy the requirements file to the working directory
COPY requirements.txt .

# Install any dependencies specified in requirements.txt
RUN pip install -r requirements.txt
# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy the current directory contents into the container at /app
COPY . /app/
# Copy the rest of the application code to the working directory
COPY . .

# Expose the port that FastAPI will run on
EXPOSE 3100
# Expose the port that the application will run on
EXPOSE 8000

# Command to run the FastAPI application
CMD ["gunicorn", "-k", "uvicorn.workers.UvicornWorker", "-b", ":3100", "app.main:app"]
# Command to run the application using Uvicorn
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]

0 comments on commit ce7ed87

Please sign in to comment.