Spaces:
Running
Running
BloodyInside
commited on
Commit
•
694f978
1
Parent(s):
5cb9fa6
afafs
Browse files- Dockerfile +19 -13
Dockerfile
CHANGED
@@ -5,16 +5,30 @@ FROM python:${PYTHON_VERSION}
|
|
5 |
ENV PYTHONDONTWRITEBYTECODE 1
|
6 |
ENV PYTHONUNBUFFERED 1
|
7 |
|
8 |
-
#
|
9 |
RUN apt-get update && apt-get install -y \
|
10 |
libpq-dev \
|
11 |
gcc \
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
&& rm -rf /var/lib/apt/lists/*
|
13 |
|
14 |
-
|
|
|
|
|
|
|
|
|
15 |
|
16 |
-
|
|
|
|
|
|
|
17 |
|
|
|
18 |
COPY requirements.txt /tmp/requirements.txt
|
19 |
RUN set -ex && \
|
20 |
pip install --upgrade pip && \
|
@@ -22,21 +36,13 @@ RUN set -ex && \
|
|
22 |
rm -rf /root/.cache/
|
23 |
COPY . /code
|
24 |
|
|
|
25 |
|
|
|
26 |
RUN python manage.py makemigrations
|
27 |
RUN python manage.py migrate --database=default
|
28 |
RUN python manage.py migrate --database=cache
|
29 |
RUN python manage.py migrate --database=DB1
|
30 |
RUN python manage.py migrate --database=DB2
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
EXPOSE 8000
|
35 |
-
|
36 |
-
# CMD ["gunicorn", "--bind", ":8000", "--workers", "1", "--worker-class", "gevent", "core.wsgi:application"]
|
37 |
-
# CMD ["daphne", "-u", "/tmp/daphne.sock", "core.asgi:application"]
|
38 |
CMD ["daphne", "-b", "0.0.0.0", "-p", "7860", "core.asgi:application"]
|
39 |
-
|
40 |
-
# CMD ["gunicorn", "--bind", ":8000", "--workers", "1", "--worker-class", "uvicorn.workers.UvicornWorker", "core.asgi:application"]
|
41 |
-
|
42 |
-
|
|
|
5 |
ENV PYTHONDONTWRITEBYTECODE 1
|
6 |
ENV PYTHONUNBUFFERED 1
|
7 |
|
8 |
+
# Install dependencies
|
9 |
RUN apt-get update && apt-get install -y \
|
10 |
libpq-dev \
|
11 |
gcc \
|
12 |
+
g++ \
|
13 |
+
wget \
|
14 |
+
unzip \
|
15 |
+
xvfb \
|
16 |
+
libxi6 \
|
17 |
+
libgconf-2-4 \
|
18 |
&& rm -rf /var/lib/apt/lists/*
|
19 |
|
20 |
+
# Install Chrome
|
21 |
+
RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \
|
22 |
+
&& echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \
|
23 |
+
&& apt-get update \
|
24 |
+
&& apt-get install -y google-chrome-stable
|
25 |
|
26 |
+
# Install ChromeDriver
|
27 |
+
RUN CHROMEDRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE` \
|
28 |
+
&& wget -O /tmp/chromedriver.zip http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip \
|
29 |
+
&& unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/
|
30 |
|
31 |
+
# Install Python dependencies
|
32 |
COPY requirements.txt /tmp/requirements.txt
|
33 |
RUN set -ex && \
|
34 |
pip install --upgrade pip && \
|
|
|
36 |
rm -rf /root/.cache/
|
37 |
COPY . /code
|
38 |
|
39 |
+
WORKDIR /code
|
40 |
|
41 |
+
# Run migrations
|
42 |
RUN python manage.py makemigrations
|
43 |
RUN python manage.py migrate --database=default
|
44 |
RUN python manage.py migrate --database=cache
|
45 |
RUN python manage.py migrate --database=DB1
|
46 |
RUN python manage.py migrate --database=DB2
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
CMD ["daphne", "-b", "0.0.0.0", "-p", "7860", "core.asgi:application"]
|
|
|
|
|
|
|
|