-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (27 loc) · 1.17 KB
/
Dockerfile
File metadata and controls
38 lines (27 loc) · 1.17 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
FROM python:3.11-slim
WORKDIR /app
RUN echo "Debug: Starting build process for Kavya server"
# Install build dependencies and wget for Cloud SQL proxy
RUN apt-get update && apt-get install -y \
build-essential \
wget \
&& rm -rf /var/lib/apt/lists/*
# Install Cloud SQL Auth proxy
RUN wget https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 -O /cloud_sql_proxy \
&& chmod +x /cloud_sql_proxy
COPY requirements.txt .
RUN pip install -r requirements.txt && pip list
COPY . .
RUN echo "Debug: Build complete. Preparing to start Kavya server"
# Create a start script that handles both dev and prod environments
RUN echo '#!/bin/bash' > start.sh && \
echo 'echo "Debug: Starting Kavya server in container"' >> start.sh && \
echo 'if [ "$ENVIRONMENT" = "prod" ]; then' >> start.sh && \
echo ' /cloud_sql_proxy --structured-logs "$INSTANCE_CONNECTION_NAME" &' >> start.sh && \
echo ' sleep 5 # Wait for proxy to start' >> start.sh && \
echo 'fi' >> start.sh && \
echo 'exec python -m kavya.openai_server --verbose --config config.yaml' >> start.sh && \
chmod +x start.sh
# Expose port for the application
EXPOSE ${PORT:-8080}
CMD ["./start.sh"]