-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (45 loc) · 1.99 KB
/
Dockerfile
File metadata and controls
56 lines (45 loc) · 1.99 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
FROM python:3.11-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive
# Set work directory
WORKDIR /app
# Install system dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
postgresql-client \
build-essential \
libpq-dev \
wget \
gnupg \
unzip \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install Chrome and ChromeDriver for Selenium
RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /usr/share/keyrings/googlechrome-linux-keyring.gpg \
&& echo "deb [arch=amd64 signed-by=/usr/share/keyrings/googlechrome-linux-keyring.gpg] 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 \
&& rm -rf /var/lib/apt/lists/*
# Install ChromeDriver using the new API
RUN CHROME_VERSION=$(google-chrome --version | awk '{print $3}' | cut -d'.' -f1-3) \
&& CHROMEDRIVER_VERSION=$(curl -s "https://googlechromelabs.github.io/chrome-for-testing/LATEST_RELEASE_${CHROME_VERSION}") \
&& wget -O /tmp/chromedriver.zip "https://storage.googleapis.com/chrome-for-testing-public/${CHROMEDRIVER_VERSION}/linux64/chromedriver-linux64.zip" \
&& unzip /tmp/chromedriver.zip -d /tmp/ \
&& mv /tmp/chromedriver-linux64/chromedriver /usr/local/bin/ \
&& chmod +x /usr/local/bin/chromedriver \
&& rm -rf /tmp/chromedriver.zip /tmp/chromedriver-linux64
# Install Python dependencies
COPY backend/requirements/ /app/requirements/
RUN pip install --no-cache-dir -r requirements/prod.txt
# Create directories for static files and logs first
RUN mkdir -p /app/staticfiles /app/media /app/backend/logs
# Copy project
COPY . /app/
# Ensure logs directory exists after copy
RUN mkdir -p /app/backend/logs
# Expose port
EXPOSE 8000
# Run the application
CMD ["sh", "-c", "cd backend && python manage.py runserver 0.0.0.0:8000"]