Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
FROM python:3.12-slim
ENV PYTHONUNBUFFERED 1
# Copy the source files to a temporary directory
COPY . /tmp/city_traffic
WORKDIR /tmp/city_traffic
# - Install the "gcc", "python3-dev" and "libpq-dev" Debian packages, which are
# needed for compiling the "psycopg2" Python package when we install it later
# with Poetry.
# - Install the "libgl1-mesa-glx" and "libglib2.0-0" Debian packages as they
# provide respectively the "libGL.so.1" and "libgthread-2.0.so.0" shared
# libraries, which are required by the "opencv-python" Python package.
# - Install the "poetry" Python package.
# - Install the Python dependencies.
# - Uninstall Poetry.
# - Copy the application files.
# - Copy the scripts.
# - Make the scripts executable.
# - Remove the temporary directory.
# - Create the Nginx log files.
RUN apt-get update && \
apt-get -y install gcc python3-dev libpq-dev libgl1-mesa-glx libglib2.0-0 && \
pip install poetry && \
poetry config virtualenvs.create false && \
poetry install --with prod && \
pip uninstall -y poetry && \
cp -r /tmp/city_traffic/src/city_traffic /city_traffic && \
cp /tmp/city_traffic/app.sh /city_traffic && \
cp /tmp/city_traffic/job.sh /city_traffic && \
chmod +x /city_traffic/app.sh && \
chmod +x /city_traffic/job.sh && \
rm -rf /tmp/city_traffic && \
mkdir /var/log/nginx && \
touch /var/log/nginx/access.log && \
touch /var/log/nginx/error.log
WORKDIR /city_traffic
# Expose the application port
EXPOSE 8000