-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.cpu
54 lines (42 loc) · 1.47 KB
/
Dockerfile.cpu
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
# Use the official Python image as the base
FROM python:3.11-slim
# Set the working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libssl-dev \
libffi-dev \
libjpeg-dev \
zlib1g-dev \
libpng-dev \
libsentencepiece-dev \
curl \
gcc \
g++ \
cmake \
&& rm -rf /var/lib/apt/lists/*
# Upgrade pip and install base packages
RUN pip install --upgrade pip setuptools wheel
# Set PYTHONPATH correctly
ENV PYTHONPATH=/app
# Set environment variables
ENV PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
ENV PYTHONUNBUFFERED=1
# Copy the requirements file
COPY requirements_cpu.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements_cpu.txt
# Copy the rest of the application code
COPY . .
# Set up the environment and logging
RUN python -m pip install --upgrade pip && \
python -c "from config.env_config import setup_environment; setup_environment()"
RUN python -c "from pathlib import Path; from config.logging_config import setup_logging; setup_logging(Path('flux_pipeline.log'))"
# Expose the application port
EXPOSE 7860
# Healthcheck
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD curl -f http://localhost:7860/ || exit 1
# Set the command to run the application
CMD ["python3", "-u", "gui.py", "--host", "0.0.0.0", "--port", "7860", "--share"]