-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
75 lines (61 loc) · 2.76 KB
/
Copy pathDockerfile
File metadata and controls
75 lines (61 loc) · 2.76 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
64
65
66
67
68
69
70
71
72
73
74
75
# Dockerfile — CAFUNE Neural Engine
#
# Requisitos do host:
# - Docker >= 24
# - NVIDIA Container Toolkit (para GPU): https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html
#
# Build:
# docker build -t cafune:latest .
#
# Run (CPU):
# docker run --rm -it cafune:latest
#
# Run (GPU):
# docker run --rm -it --gpus all cafune:latest
FROM nvidia/cuda:12.1.1-devel-ubuntu22.04
ENV DEBIAN_FRONTEND=noninteractive
ENV JULIA_VERSION=1.10.2
ENV JULIA_PATH=/opt/julia
# ── Sistema base ──────────────────────────────────────────────
RUN apt-get update && apt-get install -y --no-install-recommends \
python3.11 \
python3.11-dev \
python3-pip \
curl \
wget \
ca-certificates \
git \
build-essential \
&& rm -rf /var/lib/apt/lists/*
RUN ln -sf /usr/bin/python3.11 /usr/bin/python3 && \
ln -sf /usr/bin/python3.11 /usr/bin/python
# ── Julia ─────────────────────────────────────────────────────
RUN wget -q https://julialang-s3.julialang.org/bin/linux/x64/1.10/julia-${JULIA_VERSION}-linux-x86_64.tar.gz \
&& tar -xzf julia-${JULIA_VERSION}-linux-x86_64.tar.gz -C /opt \
&& mv /opt/julia-${JULIA_VERSION} ${JULIA_PATH} \
&& rm julia-${JULIA_VERSION}-linux-x86_64.tar.gz
ENV PATH="${JULIA_PATH}/bin:${PATH}"
# ── Python deps ───────────────────────────────────────────────
WORKDIR /app
COPY python/requirements.txt ./python/requirements.txt
RUN pip install --no-cache-dir -r python/requirements.txt
# ── Julia deps ────────────────────────────────────────────────
COPY julia/Project.toml ./julia/Project.toml
RUN julia --project=./julia -e 'using Pkg; Pkg.instantiate()'
# ── CUDA kernel (opcional — só compila se nvcc disponível) ────
COPY c/ ./c/
RUN cd c && \
mkdir -p lib && \
nvcc -O2 -arch=sm_61 --compiler-options "-fPIC" -shared \
-o lib/cafune_cuda.so src/attention.cu 2>/dev/null || \
echo "[INFO] nvcc não compilou o kernel CUDA — usando fallback CPU."
# ── Código da aplicação ───────────────────────────────────────
COPY python/ ./python/
COPY julia/ ./julia/
COPY vocab.json ./
# Criar arquivo mmap inicial
RUN python3 -c "open('python/cafune_brain.mem', 'wb').write(b'\\x00' * 1024)"
ENV PYTHONUNBUFFERED=1
ENV JULIA_NUM_THREADS=auto
EXPOSE 5000
CMD ["python3", "python/dashboard.py"]