-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
14 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,23 @@ | ||
# syntax=docker/dockerfile:1 | ||
# Use the official Python image from the Docker Hub | ||
# The slim version is lighter and more suitable for production use | ||
FROM python:3.9-slim | ||
|
||
# Set the working directory in the container | ||
WORKDIR /app | ||
|
||
# Copy the current directory contents into the container at /app | ||
COPY . /app | ||
# Copy the requirements file first to leverage Docker cache | ||
COPY requirements.txt . | ||
|
||
# Install any needed packages specified in requirements.txt | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
# Run app.py when the container launches | ||
CMD [ "python3", "-m" , "flask", "run", "--host=0.0.0.0"] | ||
# Copy the rest of the application code | ||
COPY . . | ||
|
||
# Set environment variables for Flask | ||
ENV FLASK_APP=app.py | ||
ENV FLASK_RUN_HOST=0.0.0.0 | ||
ENV FLASK_ENV=production # Set to "development" if you need to enable debug mode | ||
|
||
# Run the application | ||
CMD ["flask", "run"] |