-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.celery
More file actions
61 lines (46 loc) · 1.58 KB
/
Copy pathDockerfile.celery
File metadata and controls
61 lines (46 loc) · 1.58 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
57
58
59
60
61
# Stage 1: Builder
FROM python:3.13.3-slim AS builder
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Install system packages
RUN apt-get update && apt-get install -y \
libmagic1 \
file \
libpcap-dev \
dnsutils \
curl \
&& rm -rf /var/lib/apt/lists/*
# Prepare /app for installing Python packages
WORKDIR /app
# Install only requirements.txt to benefit from caching
COPY ./django_app/requirements.txt .
RUN pip install --upgrade pip && \
pip install --no-cache-dir --prefix=/install -r requirements.txt
# Stage 2: Final image
FROM python:3.13.3-slim
RUN apt-get update && apt-get install -y \
libmagic1 \
file \
libpcap-dev \
curl \
dnsutils \
&& rm -rf /var/lib/apt/lists/*
RUN useradd -m -r bbpaneluser && \
mkdir /app && chown -R bbpaneluser /app && \
mkdir -p /var/log/django && chown -R bbpaneluser /var/log/django
# Copy installed packages and tools
COPY --from=builder /usr/local/lib/python*/site-packages/ /usr/local/lib/python*/site-packages/
COPY --from=builder /install /usr/local
# Copy prebuilt binaries
COPY --chown=bbpaneluser:bbpaneluser bbpanel_watch/bin /usr/local/bin
RUN chmod +x /usr/local/bin/*
# Copy project files as last step for better cache
WORKDIR /app
COPY --chown=bbpaneluser:bbpaneluser . .
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
USER bbpaneluser
RUN chmod +x /app/worker_entrypoint.sh
COPY --chown=bbpaneluser:bbpaneluser bbpanel_watch/bbpanel_watch_aliases.sh /etc/profile.d/bbpanel_watch_aliases.sh
RUN chmod +x /etc/profile.d/bbpanel_watch_aliases.sh
ENTRYPOINT ["/app/worker_entrypoint.sh"]