-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (32 loc) · 1.16 KB
/
Dockerfile
File metadata and controls
43 lines (32 loc) · 1.16 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
FROM python:3.12-slim
# Set the working directory
WORKDIR /app
# Install required system dependencies (git, etc.)
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Copy application files
COPY . /app
# Add the Python path for the app
ENV PYTHONPATH=/app
# Install Python dependencies
COPY requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Clone or pull the latest .proto files
RUN git clone https://github.com/Chatbot-Builder-Project/chatbot-builder-protos.git
# Create the directory structure for generated gRPC files
RUN mkdir -p app/generated/v1
# Generate gRPC code
RUN python -m grpc_tools.protoc \
--proto_path=chatbot-builder-protos/protos \
--python_out=app/generated \
--grpc_python_out=app/generated \
chatbot-builder-protos/protos/v1/executor/*.proto
# Fix imports in the generated gRPC files
RUN find app/generated/v1/executor/ -name "*_pb2*.py" \
-exec sed -i 's/from v1\.executor/from app.generated.v1.executor/g' {} +
# Expose the gRPC server port
EXPOSE 50051
# Command to run the gRPC server
CMD ["python", "app/main.py"]