-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
53 lines (35 loc) · 1.12 KB
/
Copy pathDockerfile
File metadata and controls
53 lines (35 loc) · 1.12 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
# Version is passed from VERSION file via build.sh (--build-arg VERSION=...)
ARG VERSION=dev
FROM python:3.11-slim as builder
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
COPY server/requirements.txt .
RUN pip install --user --no-cache-dir -r requirements.txt
FROM python:3.11-slim
ARG VERSION=dev
LABEL org.opencontainers.image.version="${VERSION}"
WORKDIR /app
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PATH=/root/.local/bin:$PATH
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
libpq5 \
libpq-dev \
build-essential \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /root/.local /root/.local
RUN pip install --no-cache-dir psycopg[pool]
COPY server/server.py .
COPY server/api_models.py .
COPY server/tests ./tests
COPY server/services ./services
RUN mkdir -p /var/lib/mem0 && \
chmod 755 /var/lib/mem0
EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=10s --start-period=45s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1
CMD ["python", "server.py"]