-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathDockerfile
55 lines (36 loc) · 1.28 KB
/
Dockerfile
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
# Frontend
FROM node:20-alpine3.18 as frontend
WORKDIR /usr/src/app
COPY ./frontend ./frontend
WORKDIR /usr/src/app/frontend
RUN npm install && npm run build && rm -rf node_modules
# Backend
FROM python:3.11-slim-bookworm as backend
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential libmagic-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY pyproject.toml poetry.lock ./
RUN poetry config virtualenvs.create false \
&& poetry install --without dev
# Main
FROM python:3.11-slim-bookworm
COPY --from=backend /usr/local/lib/python3.11/site-packages/ /usr/local/lib/python3.11/site-packages/
COPY --from=backend /usr/local/bin/ /usr/local/bin/
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential libmagic-dev spamd \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN sa-update --no-gpg
WORKDIR /usr/src/app
COPY gunicorn.conf.py circus.ini ./
COPY backend ./backend
COPY --from=frontend /usr/src/app/frontend ./frontend
ENV SPAMD_MAX_CHILDREN=1
ENV SPAMD_PORT=7833
ENV SPAMD_RANGE="10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,127.0.0.1/32"
ENV SPAMASSASSIN_PORT=7833
ENV PORT=8000
CMD ["circusd", "/usr/src/app/circus.ini"]