Skip to content

Commit 75d5fa4

Browse files
Optimizing Dockerfile (#751)
1 parent e64fad2 commit 75d5fa4

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

docker/lerobot-gpu/Dockerfile

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,25 @@
11
FROM nvidia/cuda:12.4.1-base-ubuntu22.04
22

3-
# Configure image
3+
# Configure environment variables
44
ARG PYTHON_VERSION=3.10
5-
ARG DEBIAN_FRONTEND=noninteractive
6-
5+
ENV DEBIAN_FRONTEND=noninteractive
6+
ENV MUJOCO_GL="egl"
7+
ENV PATH="/opt/venv/bin:$PATH"
78

8-
# Install apt dependencies
9+
# Install dependencies and set up Python in a single layer
910
RUN apt-get update && apt-get install -y --no-install-recommends \
1011
build-essential cmake git git-lfs \
1112
libglib2.0-0 libgl1-mesa-glx libegl1-mesa ffmpeg \
1213
speech-dispatcher libgeos-dev \
1314
python${PYTHON_VERSION}-dev python${PYTHON_VERSION}-venv \
14-
&& apt-get clean && rm -rf /var/lib/apt/lists/*
15-
15+
&& ln -s /usr/bin/python${PYTHON_VERSION} /usr/bin/python \
16+
&& python -m venv /opt/venv \
17+
&& apt-get clean && rm -rf /var/lib/apt/lists/* \
18+
&& echo "source /opt/venv/bin/activate" >> /root/.bashrc
1619

17-
# Create virtual environment
18-
RUN ln -s /usr/bin/python${PYTHON_VERSION} /usr/bin/python
19-
RUN python -m venv /opt/venv
20-
ENV PATH="/opt/venv/bin:$PATH"
21-
RUN echo "source /opt/venv/bin/activate" >> /root/.bashrc
22-
23-
# Install LeRobot
24-
RUN git lfs install
25-
RUN git clone https://github.com/huggingface/lerobot.git /lerobot
20+
# Clone repository and install LeRobot in a single layer
2621
WORKDIR /lerobot
27-
RUN pip install --upgrade --no-cache-dir pip
28-
RUN pip install --no-cache-dir ".[test, aloha, xarm, pusht, dynamixel]"
29-
30-
# Set EGL as the rendering backend for MuJoCo
31-
ENV MUJOCO_GL="egl"
22+
RUN git lfs install \
23+
&& git clone https://github.com/huggingface/lerobot.git . \
24+
&& /opt/venv/bin/pip install --upgrade --no-cache-dir pip \
25+
&& /opt/venv/bin/pip install --no-cache-dir ".[test, aloha, xarm, pusht, dynamixel]"

0 commit comments

Comments
 (0)