Created
November 27, 2024 10:57
-
-
Save Logrus/81dda0b050f13cd51005614817434211 to your computer and use it in GitHub Desktop.
basic-docker-dl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"build": { | |
"dockerfile": "Dockerfile", | |
"context": "..", | |
"args": { | |
"USER_NAME": "${localEnv:USER}", | |
"USER_UID": "1000", | |
"USER_GID": "1000" | |
} | |
}, | |
"remoteUser": "${localEnv:USER}", | |
"runArgs": [ | |
"--shm-size=16g", | |
"--gpus=all", | |
"--network=host", | |
"-e", | |
"NVIDIA_DRIVER_CAPABILITIES=all", // Expose all NVIDIA driver capabilities | |
"-e", | |
"DISPLAY=${env:DISPLAY}", | |
"-e", | |
"XAUTHORITY=${localEnv:XAUTHORITY}" | |
], | |
"postAttachCommand": "/bin/bash", | |
"customizations": { | |
"vscode": { | |
"extensions": [ | |
"ms-python.black-formatter", | |
"ms-python.debugpy", | |
"ms-python.isort", | |
"ms-python.mypy-type-checker", | |
"ms-python.python", | |
"ms-python.vscode-pylance", | |
"Rubymaniac.vscode-direnv", | |
"streetsidesoftware.code-spell-checker" | |
] | |
} | |
}, | |
"mounts": [ | |
// Set up the folder with data to mount | |
// { | |
// "source": "/home/${localEnv:USER}/data", | |
// "target": "/data", | |
// "type": "bind" | |
// }, | |
{ | |
"source": "/tmp/.X11-unix", | |
"target": "/tmp/.X11-unix", | |
"type": "bind" | |
}, | |
{ | |
"source": "${localEnv:XAUTHORITY}", // XAUTH path from the host environment | |
"target": "/tmp/.docker.xauth", // Inside the container, mounted as .docker.xauth | |
"type": "bind" | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:22.04 | |
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ | |
build-essential \ | |
direnv \ | |
git \ | |
git-lfs \ | |
libgtk-3-dev \ | |
libxkbcommon-x11-0 \ | |
python3-opencv \ | |
python3-pip \ | |
python3-setuptools \ | |
python3-tk \ | |
python3-wheel \ | |
sudo \ | |
unzip \ | |
vulkan-tools \ | |
wget \ | |
&& apt-get clean && rm -rf /var/lib/apt/lists/* | |
COPY requirements.txt /tmp/requirements.txt | |
RUN pip3 install --no-cache-dir -r /tmp/requirements.txt | |
ARG USER_UID=1000 | |
ARG USER_GID=1000 | |
ARG USER_NAME | |
RUN groupadd --gid ${USER_GID} ${USER_NAME} && \ | |
useradd --create-home --gid ${USER_GID} --uid ${USER_UID} ${USER_NAME} && \ | |
usermod -aG sudo ${USER_NAME} && \ | |
echo "${USER_NAME} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \ | |
mkdir -p /home/${USER_NAME} && \ | |
chown -R ${USER_UID}:${USER_GID} /home/${USER_NAME} && \ | |
mkdir /home/${USER_NAME}/workspace | |
USER ${USER_NAME} | |
WORKDIR /home/${USER_NAME}/workspace | |
RUN echo 'eval "$(direnv hook bash)"' >> ~/.bashrc | |
SHELL [ "/bin/bash", "-c" ] | |
ENV SHELL=/bin/bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment