forked from SlavaSkvortsov/arq-django-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (41 loc) · 1.26 KB
/
Copy pathDockerfile
File metadata and controls
54 lines (41 loc) · 1.26 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
# Multi-stage build for arq-dashboard
FROM python:3.10-slim as builder
WORKDIR /app
# Install build dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
gcc \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt
# Final stage
FROM python:3.10-slim
WORKDIR /app
# Copy Python dependencies from builder
COPY --from=builder /root/.local /root/.local
# Copy application code
COPY arq_admin/ ./arq_admin/
COPY setup.py .
COPY README.md .
COPY requirements.txt .
COPY docker_settings.py .
COPY docker_urls.py .
COPY docker_wsgi.py .
COPY docker_middleware.py .
# Make sure scripts in .local are usable
ENV PATH=/root/.local/bin:$PATH
# Install the package
RUN pip install --no-cache-dir -e .
# Expose Django default port
EXPOSE 8000
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV DJANGO_SETTINGS_MODULE=docker_settings
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD python -c "import sys; sys.exit(0)"
# Initialize database and run server
CMD python -m django migrate --noinput && \
python -m django collectstatic --noinput && \
python -m django runserver 0.0.0.0:8000