-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
88 lines (67 loc) · 2.49 KB
/
Dockerfile
File metadata and controls
88 lines (67 loc) · 2.49 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
76
77
78
79
80
81
82
83
84
85
86
87
88
# Robust Vision Production Image - Multi-Stage Build
# Repository: https://github.com/or4k2l/robust-vision
# ============================================
# Stage 1: Builder (with dev dependencies)
# ============================================
FROM nvidia/cuda:12.1.0-cudnn8-devel-ubuntu22.04 AS builder
LABEL maintainer="or4k2l"
LABEL repository="https://github.com/or4k2l/robust-vision"
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
# Install Python and build dependencies
RUN apt-get update && apt-get install -y \
python3.10 \
python3-pip \
python3-dev \
build-essential \
git \
wget \
&& rm -rf /var/lib/apt/lists/*
# Set Python 3.10 as default
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1
RUN update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
# Upgrade pip
RUN pip install --upgrade pip setuptools wheel
# Set working directory
WORKDIR /app
# Copy requirements and install dependencies
COPY requirements.txt /app/
RUN pip install --no-cache-dir -r requirements.txt
# Copy source code
COPY . /app/
# Install the package
RUN pip install --no-cache-dir -e .
# ============================================
# Stage 2: Runtime (minimal, production-ready)
# ============================================
FROM nvidia/cuda:12.1.0-cudnn8-runtime-ubuntu22.04
LABEL maintainer="or4k2l"
LABEL repository="https://github.com/or4k2l/robust-vision"
LABEL description="Production-ready robust vision training framework"
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV JAX_PLATFORM_NAME=cuda
ENV PYTHONDONTWRITEBYTECODE=1
# Install Python (runtime only)
RUN apt-get update && apt-get install -y \
python3.10 \
python3-pip \
&& rm -rf /var/lib/apt/lists/*
# Set Python 3.10 as default
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1
RUN update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
# Set working directory
WORKDIR /app
# Copy Python packages from builder
COPY --from=builder /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages
COPY --from=builder /app /app
# Create directories for data, checkpoints, and logs
RUN mkdir -p /app/data /app/checkpoints /app/logs /app/results
# Expose TensorBoard port
EXPOSE 6006
# Create volume mount points
VOLUME ["/app/data", "/app/checkpoints", "/app/results"]
# Set the default command
CMD ["python", "scripts/train.py", "--config", "configs/baseline.yaml"]