-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDockerfile
32 lines (25 loc) · 1018 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Use an official Python runtime as a parent image
FROM python:3.9-slim
# Set environment variables
# Prevents Python from writing pyc files to disc (equivalent to python -B option)
ENV PYTHONDONTWRITEBYTECODE 1
# Prevents Python from buffering stdout and stderr (equivalent to python -u option)
ENV PYTHONUNBUFFERED 1
# Set the working directory inside the container
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
git \
libpq-dev \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY requirements.txt /app/
RUN pip install --no-cache-dir -r requirements.txt
# Copy the Flask app files into the container
COPY . /app/
# Expose port 5000 for the Flask app to listen on when running within the container
EXPOSE 5000
# Define the command to start the container. Use gunicorn as the WSGI server to serve the Flask app
# CMD ["gunicorn", "--bind", "0.0.0.0:5000", "app:app"]
CMD ["python", "app.py"]