Permalink
Cannot retrieve contributors at this time
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?
city-traffic/Dockerfile
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
43 lines (37 sloc)
1.47 KB
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
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 |