-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile
More file actions
59 lines (44 loc) · 1.79 KB
/
Copy pathDockerfile
File metadata and controls
59 lines (44 loc) · 1.79 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
# Use an official Python runtime as a parent image
FROM --platform=$TARGETPLATFORM python:3.11.7-bullseye
# Set build-time platform argument
ARG TARGETPLATFORM="linux/amd64"
# Set the working directory in the container to /app
WORKDIR /app
# Handle apt-get update with a retry strategy to mitigate network issues
RUN for i in {1..5}; do apt-get update && break || sleep 15; done
# Install necessary packages
RUN apt-get install -y --no-install-recommends \
gcc \
g++ \
make \
gnupg \
ca-certificates \
git \
libmagic1 \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Upgrade pip and install poetry
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir poetry==2.1.3
# Copy only pyproject.toml and poetry.lock first
COPY pyproject.toml poetry.lock ./
# Configure poetry and install dependencies with better error handling
RUN poetry config virtualenvs.create false \
&& poetry config installer.max-workers 10 \
&& poetry install --no-interaction --no-ansi --no-root --no-cache
# Download the spaCy language model
RUN python -m spacy download en_core_web_sm
# Now copy the rest of the application
COPY . .
# Install the project itself with no cache
RUN poetry install --no-interaction --no-ansi --no-cache
# Verify FastAPI installation
RUN python -c "import fastapi" || pip install fastapi==0.115.6
# Make port 5001 available
EXPOSE 5001
# Make the startup scripts executable
RUN chmod +x start_all_services.sh start_all_services.py
# Make the open source entrypoint executable (for auto-bootstrap)
RUN chmod +x scripts/opensource/docker_entrypoint_opensource.sh
# Run all services (web server + Temporal workers) when the container launches
# Using Python version for better error handling and process management
CMD ["python", "start_all_services.py"]