Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
69 lines (55 loc) · 1.89 KB
/
Copy pathDockerfile
File metadata and controls
69 lines (55 loc) · 1.89 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
# Base image
FROM nvidia/cuda:12.2.2-devel-ubuntu22.04
# Prevents prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
# Install system dependencies including git, sudo, and add deadsnakes PPA for Python 3.12
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
software-properties-common \
sudo \
ssh \
tmux \
vim \
htop \
unzip \
&& add-apt-repository ppa:deadsnakes/ppa \
&& apt-get update && apt-get install -y --no-install-recommends \
python3.12 \
python3.12-dev \
python3.12-venv \
python3-pip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install uv system-wide and create python symlink
RUN curl -LsSf https://astral.sh/uv/install.sh | sh && \
mv /root/.local/bin/uv /usr/local/bin/uv && \
ln -s /usr/bin/python3.12 /usr/bin/python
# Add build arguments for user and group IDs
ARG USER_ID=1000
ARG GROUP_ID=1000
# Create a non-root user 'dev' and add to sudo group
RUN groupadd -g $GROUP_ID dev && \
useradd -u $USER_ID -g $GROUP_ID -s /bin/bash -m dev && \
adduser dev sudo && \
echo "dev ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \
chown -R dev:dev /home/dev
# Set up the working directory
WORKDIR /app
# Copy project files
COPY . .
RUN chown -R dev:dev /app
# Create a cache directory for uv inside /app and set ownership
RUN mkdir -p /app/.uv_cache && chown -R dev:dev /app/.uv_cache
# Set UV_CACHE_DIR environment variable
ENV UV_CACHE_DIR="/app/.uv_cache"
# Switch to the new user
USER dev
# Set the entrypoint to run our setup script via bash
# This avoids host filesystem permission issues with the script itself.
ENTRYPOINT ["/bin/bash", "/app/entrypoint.sh"]
# Add venv to PATH for interactive shells
ENV PATH="/app/.venv/bin:/home/dev/.local/bin:${PATH}"
# Default command to run if no other command is specified
CMD ["/bin/bash"]