-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
64 lines (55 loc) · 1.98 KB
/
Copy pathDockerfile
File metadata and controls
64 lines (55 loc) · 1.98 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
FROM python:3.13 AS base
FROM base AS builder
# Builder image
RUN mkdir /install
RUN mkdir /app
RUN mkdir /app/models
ENV PATH="/root/.local/bin:${PATH}"
RUN export DEBIAN_FRONTEND=noninteractive && apt update
RUN export DEBIAN_FRONTEND=noninteractive && apt-get -yq install gcc python3-dev make curl g++ ffmpeg
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
ENV PATH="/root/.local/bin:${PATH}"
RUN curl https://github.com/DarthSim/hivemind/releases/download/v1.1.0/hivemind-v1.1.0-linux-amd64.gz -fsL -o hivemind-v1.1.0-linux-amd64.gz && gunzip hivemind-v1.1.0-linux-amd64.gz && chmod u+x hivemind-v1.1.0-linux-amd64
# Set the working directory
WORKDIR /src
# Copy the dependency files
COPY pyproject.toml uv.lock ./
ENV UV_PROJECT_ENVIRONMENT=/venv
RUN uv sync --frozen --no-dev --no-install-project
# Download and cache ML models
COPY download_models.py /app/download_models.py
ENV HF_HOME=/app/models
RUN /venv/bin/python /app/download_models.py
# Now do the static images
COPY _static /src/_static
COPY scripts /src/scripts
COPY styles /src/styles
COPY templates /src/templates
COPY Makefile /src/Makefile
COPY tailwind.config.js /src/tailwind.config.js
RUN mkdir /src/static
RUN make install-tailwind && make
# Now the final image
FROM base
# set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV HF_HOME=/app/models
RUN export DEBIAN_FRONTEND=noninteractive && apt update
RUN export DEBIAN_FRONTEND=noninteractive && apt-get -yq install nginx postgresql-client ffmpeg
# Copy requirements from builder
COPY --from=builder /venv /venv
# Copy pre-cached models
COPY --from=builder /app/models /app/models
WORKDIR /app
# Bundle app sources
COPY Procfile Procfile
COPY srht srht
COPY templates templates
COPY emails emails
COPY manage.py manage.py
COPY db_schema/updates /migrations
COPY nginx/basic.conf /etc/nginx/sites-available/default
COPY --from=builder /src/static /app/static
COPY --from=builder /hivemind-v1.1.0-linux-amd64 .
CMD ["/app/hivemind-v1.1.0-linux-amd64"]