-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.combined.dev
65 lines (49 loc) · 1.52 KB
/
Dockerfile.combined.dev
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
62
63
64
65
# Go builder stage
FROM golang:1.23.2 as go-builder
WORKDIR /app
# Build gRPC API
COPY api/go.mod api/go.sum ./
RUN go mod download
COPY api .
RUN CGO_ENABLED=0 GOOS=linux go build -o /text2manim-api ./cmd/server
# Build Gateway
COPY api/go.mod api/go.sum ./
RUN go mod download
COPY api .
RUN CGO_ENABLED=0 GOOS=linux go build -o /text2manim-gateway ./cmd/gateway
# Python stage
FROM python:3.12-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
ffmpeg \
texlive-base \
texlive-latex-extra \
pkg-config \
libcairo2-dev \
build-essential \
libpango1.0-dev \
&& rm -rf /var/lib/apt/lists/*
ENV PKG_CONFIG_PATH="/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/share/pkgconfig:$PKG_CONFIG_PATH"
ENV PYTHONPATH=/app:/app/src:$PYTHONPATH
# Copy Python project files
COPY worker/pyproject.toml worker/requirements.lock* worker/README.md /app/
# Install Python dependencies
RUN pip install --no-cache-dir pycairo uv
RUN uv pip install --no-cache --system -r requirements.lock
# Copy Python application code
COPY worker /app/
# Copy Go binaries from go-builder stage
COPY --from=go-builder /text2manim-api /app/
COPY --from=go-builder /text2manim-gateway /app/
COPY --from=go-builder /app/.env /app/.env-api
RUN cat /app/.env-api >> .env
# Expose necessary ports
EXPOSE 50051 50052 8080
# Create a startup script
RUN echo '#!/bin/bash\n\
/app/text2manim-api &\n\
/app/text2manim-gateway &\n\
python -m src.main\n\
' > /app/start.sh && chmod +x /app/start.sh
CMD ["/app/start.sh"]