Fix docker-compose implementation
Browse files- Dockerfile +17 -21
- docker-compose.yml +66 -8
Dockerfile
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
# Use Python slim image as base
|
2 |
-
FROM python:3.10-slim
|
3 |
|
4 |
# Set environment variables
|
5 |
ENV PYTHONUNBUFFERED=1 \
|
@@ -9,36 +9,32 @@ ENV PYTHONUNBUFFERED=1 \
|
|
9 |
# Create and set working directory
|
10 |
WORKDIR /app
|
11 |
|
12 |
-
#
|
|
|
|
|
|
|
13 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
14 |
-
build-essential \
|
15 |
curl \
|
16 |
-
|
17 |
cmake \
|
18 |
&& rm -rf /var/lib/apt/lists/*
|
19 |
|
20 |
-
#
|
21 |
-
|
22 |
-
|
23 |
-
# Install project in editable mode
|
24 |
-
RUN pip install -e .
|
25 |
|
26 |
-
#
|
27 |
-
|
28 |
-
|
|
|
29 |
|
30 |
# Switch to non-root user
|
31 |
USER appuser
|
32 |
|
|
|
|
|
|
|
33 |
# Expose Gradio port
|
34 |
EXPOSE 7860
|
35 |
|
36 |
-
#
|
37 |
-
|
38 |
-
MAGPIE_PRE_QUERY_TEMPLATE="llama3" \
|
39 |
-
MAX_NUM_TOKENS=2048 \
|
40 |
-
MAX_NUM_ROWS=1000 \
|
41 |
-
DEFAULT_BATCH_SIZE=5
|
42 |
-
|
43 |
-
# Start command
|
44 |
-
CMD ["python", "-m", "synthetic_dataset_generator"]
|
|
|
1 |
# Use Python slim image as base
|
2 |
+
FROM python:3.10-slim
|
3 |
|
4 |
# Set environment variables
|
5 |
ENV PYTHONUNBUFFERED=1 \
|
|
|
9 |
# Create and set working directory
|
10 |
WORKDIR /app
|
11 |
|
12 |
+
# Create non-root user first
|
13 |
+
RUN useradd -m -u 1000 appuser
|
14 |
+
|
15 |
+
# Install system dependencies including build tools
|
16 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
17 |
curl \
|
18 |
+
build-essential \
|
19 |
cmake \
|
20 |
&& rm -rf /var/lib/apt/lists/*
|
21 |
|
22 |
+
# Install pdm
|
23 |
+
RUN pip install --no-cache-dir pdm
|
|
|
|
|
|
|
24 |
|
25 |
+
# Copy project files and set permissions
|
26 |
+
COPY . .
|
27 |
+
RUN chown -R appuser:appuser /app && \
|
28 |
+
chmod -R 755 /app
|
29 |
|
30 |
# Switch to non-root user
|
31 |
USER appuser
|
32 |
|
33 |
+
# Install dependencies in a virtual environment
|
34 |
+
RUN pdm install --prod --no-lock
|
35 |
+
|
36 |
# Expose Gradio port
|
37 |
EXPOSE 7860
|
38 |
|
39 |
+
# Start command using pdm run to use the virtual environment
|
40 |
+
CMD ["pdm", "run", "python", "-m", "synthetic_dataset_generator"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docker-compose.yml
CHANGED
@@ -5,20 +5,78 @@ services:
|
|
5 |
build: .
|
6 |
ports:
|
7 |
- "7860:7860"
|
8 |
-
env_file:
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
healthcheck:
|
13 |
-
test: ["CMD", "curl", "-f", "http://localhost:
|
14 |
interval: 30s
|
15 |
timeout: 10s
|
16 |
retries: 3
|
17 |
-
start_period: 40s
|
18 |
-
restart: unless-stopped
|
19 |
|
20 |
volumes:
|
21 |
-
|
|
|
|
|
22 |
|
23 |
networks:
|
24 |
app-network:
|
|
|
5 |
build: .
|
6 |
ports:
|
7 |
- "7860:7860"
|
8 |
+
env_file: .env
|
9 |
+
networks:
|
10 |
+
- app-network
|
11 |
+
depends_on:
|
12 |
+
ollama:
|
13 |
+
condition: service_healthy
|
14 |
+
required: false
|
15 |
+
argilla:
|
16 |
+
condition: service_healthy
|
17 |
+
required: false
|
18 |
+
|
19 |
+
ollama:
|
20 |
+
image: ollama/ollama:${OLLAMA_HARDWARE:-latest}
|
21 |
+
profiles:
|
22 |
+
- with-ollama
|
23 |
+
ports:
|
24 |
+
- "11434:11434"
|
25 |
+
volumes:
|
26 |
+
- ollama_data:/root/.ollama
|
27 |
+
networks:
|
28 |
+
- app-network
|
29 |
+
healthcheck:
|
30 |
+
test: ["CMD", "curl", "-f", "http://localhost:11434/api/health"]
|
31 |
+
interval: 30s
|
32 |
+
timeout: 10s
|
33 |
+
retries: 3
|
34 |
+
command: ollama serve
|
35 |
+
|
36 |
+
elasticsearch:
|
37 |
+
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.13
|
38 |
+
environment:
|
39 |
+
- discovery.type=single-node
|
40 |
+
- xpack.security.enabled=false
|
41 |
+
volumes:
|
42 |
+
- es_data:/usr/share/elasticsearch/data
|
43 |
+
networks:
|
44 |
+
- app-network
|
45 |
+
healthcheck:
|
46 |
+
test: ["CMD", "curl", "-f", "http://localhost:9200"]
|
47 |
+
interval: 30s
|
48 |
+
timeout: 10s
|
49 |
+
retries: 3
|
50 |
+
|
51 |
+
argilla:
|
52 |
+
image: argilla/argilla-server:latest
|
53 |
+
profiles:
|
54 |
+
- with-argilla
|
55 |
+
ports:
|
56 |
+
- "6900:6900"
|
57 |
+
env_file: .env
|
58 |
+
environment:
|
59 |
+
- USERNAME=${ARGILLA_USERNAME}
|
60 |
+
- PASSWORD=${ARGILLA_PASSWORD}
|
61 |
+
- API_KEY=${ARGILLA_API_KEY}
|
62 |
+
- ELASTICSEARCH_URL=http://elasticsearch:9200
|
63 |
+
volumes:
|
64 |
+
- argilla_data:/argilla
|
65 |
+
networks:
|
66 |
+
- app-network
|
67 |
+
depends_on:
|
68 |
+
elasticsearch:
|
69 |
+
condition: service_healthy
|
70 |
healthcheck:
|
71 |
+
test: ["CMD", "curl", "-f", "http://localhost:6900/api/health"]
|
72 |
interval: 30s
|
73 |
timeout: 10s
|
74 |
retries: 3
|
|
|
|
|
75 |
|
76 |
volumes:
|
77 |
+
ollama_data:
|
78 |
+
argilla_data:
|
79 |
+
es_data:
|
80 |
|
81 |
networks:
|
82 |
app-network:
|