Spaces:
Running
Running
ARG PYTHON_VERSION=3.12-slim-bullseye | |
FROM python:${PYTHON_VERSION} | |
ENV PYTHONDONTWRITEBYTECODE 1 | |
ENV PYTHONUNBUFFERED 1 | |
# Install dependencies | |
RUN apt-get update && apt-get install -y \ | |
libpq-dev \ | |
gcc \ | |
g++ \ | |
wget \ | |
unzip \ | |
xvfb \ | |
libxi6 \ | |
libgconf-2-4 \ | |
gnupg \ | |
curl \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Install Chrome | |
RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \ | |
&& echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \ | |
&& apt-get update \ | |
&& apt-get install -y google-chrome-stable | |
# Install ChromeDriver | |
RUN CHROMEDRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE` \ | |
&& wget -O /tmp/chromedriver.zip http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip \ | |
&& unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/ | |
# Install Python dependencies | |
COPY requirements.txt /tmp/requirements.txt | |
RUN set -ex && \ | |
pip install --upgrade pip && \ | |
pip install -r /tmp/requirements.txt && \ | |
rm -rf /root/.cache/ | |
COPY . /code | |
WORKDIR /code | |
# Run migrations | |
RUN python manage.py makemigrations | |
RUN python manage.py migrate --database=default | |
RUN python manage.py migrate --database=cache | |
RUN python manage.py migrate --database=DB1 | |
RUN python manage.py migrate --database=DB2 | |
CMD ["daphne", "-b", "0.0.0.0", "-p", "7860", "core.asgi:application"] | |