25 lines
626 B
Docker
25 lines
626 B
Docker
# Use the official Python 3.9 slim image
|
|
FROM python:3.9-slim
|
|
|
|
# Set the working directory
|
|
WORKDIR /app
|
|
|
|
# Copy the requirements file and install dependencies
|
|
COPY requirements.txt ./
|
|
RUN pip install --upgrade pip && pip install -r requirements.txt
|
|
|
|
# Copy the rest of the application code
|
|
COPY . .
|
|
|
|
# Set environment variables for production
|
|
ENV FLASK_ENV=production
|
|
ENV FLASK_APP=isalive.py
|
|
ENV FLASK_RUN_HOST=0.0.0.0
|
|
ENV FLASK_RUN_PORT=5050
|
|
|
|
# Expose port 7000 (the internal port where the app will run)
|
|
EXPOSE 5050
|
|
|
|
# Use Gunicorn to serve the app on port 7000
|
|
CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:5050", "run:app"]
|