mirror of
https://github.com/kodxana/madiator-docker-runpod.git
synced 2024-12-18 03:56:33 +01:00
Added smaller Base template
This commit is contained in:
parent
591b40b8cb
commit
19f2202fa5
4 changed files with 154 additions and 0 deletions
84
better-base/Dockerfile
Normal file
84
better-base/Dockerfile
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
ARG BASE_IMAGE
|
||||||
|
FROM ${BASE_IMAGE} AS base
|
||||||
|
|
||||||
|
ARG PYTHON_VERSION
|
||||||
|
|
||||||
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||||
|
|
||||||
|
# Set environment variables
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
ENV SHELL=/bin/bash
|
||||||
|
|
||||||
|
# Set the working directory
|
||||||
|
WORKDIR /
|
||||||
|
|
||||||
|
# Create workspace directory
|
||||||
|
RUN mkdir /workspace
|
||||||
|
|
||||||
|
# Update, upgrade, install packages, install python if PYTHON_VERSION is specified, clean up
|
||||||
|
RUN apt-get update --yes && \
|
||||||
|
apt-get upgrade --yes && \
|
||||||
|
apt install --yes --no-install-recommends \
|
||||||
|
git wget curl bash libgl1 software-properties-common \
|
||||||
|
openssh-server nginx rsync nano ffmpeg tmux && \
|
||||||
|
if [ -n "${PYTHON_VERSION}" ]; then \
|
||||||
|
add-apt-repository ppa:deadsnakes/ppa && \
|
||||||
|
apt install "python${PYTHON_VERSION}-dev" "python${PYTHON_VERSION}-venv" -y --no-install-recommends; \
|
||||||
|
fi && \
|
||||||
|
apt-get autoremove -y && \
|
||||||
|
apt-get clean && \
|
||||||
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
|
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
|
||||||
|
|
||||||
|
# Set up Python and pip only if PYTHON_VERSION is specified
|
||||||
|
RUN if [ -n "${PYTHON_VERSION}" ]; then \
|
||||||
|
ln -s /usr/bin/python${PYTHON_VERSION} /usr/bin/python && \
|
||||||
|
rm /usr/bin/python3 && \
|
||||||
|
ln -s /usr/bin/python${PYTHON_VERSION} /usr/bin/python3 && \
|
||||||
|
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
|
||||||
|
python get-pip.py && \
|
||||||
|
rm get-pip.py; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
RUN pip install --upgrade --no-cache-dir pip
|
||||||
|
|
||||||
|
# Install code-server and extensions
|
||||||
|
RUN curl -fsSL https://code-server.dev/install.sh | sh && \
|
||||||
|
code-server --install-extension ms-python.python && \
|
||||||
|
code-server --install-extension ms-toolsai.jupyter && \
|
||||||
|
code-server --install-extension ms-toolsai.vscode-jupyter-powertoys
|
||||||
|
|
||||||
|
# Pre-install Jupyter kernel and OhMyRunPod
|
||||||
|
RUN pip install ipykernel && \
|
||||||
|
python -m ipykernel install --name "python3" --display-name "Python 3" && \
|
||||||
|
pip install OhMyRunPod
|
||||||
|
|
||||||
|
# Remove existing SSH host keys
|
||||||
|
RUN rm -f /etc/ssh/ssh_host_*
|
||||||
|
|
||||||
|
# Copy necessary files
|
||||||
|
COPY settings.json /root/.local/share/code-server/User/settings.json
|
||||||
|
|
||||||
|
# Final stage: minimal image
|
||||||
|
FROM ${BASE_IMAGE}
|
||||||
|
|
||||||
|
COPY --from=base / /
|
||||||
|
|
||||||
|
# NGINX Proxy
|
||||||
|
COPY --from=proxy nginx.conf /etc/nginx/nginx.conf
|
||||||
|
COPY --from=proxy readme.html /usr/share/nginx/html/readme.html
|
||||||
|
|
||||||
|
# Copy the README.md
|
||||||
|
COPY README.md /usr/share/nginx/html/README.md
|
||||||
|
|
||||||
|
# Start Scripts
|
||||||
|
COPY --from=scripts start.sh /
|
||||||
|
RUN chmod +x /start.sh
|
||||||
|
|
||||||
|
# Welcome Message
|
||||||
|
COPY --from=logo runpod.txt /etc/runpod.txt
|
||||||
|
RUN echo 'cat /etc/runpod.txt' >> /root/.bashrc && \
|
||||||
|
echo 'echo -e "\nFor detailed documentation and guides, please visit:\n\033[1;34mhttps://docs.runpod.io/\033[0m and \033[1;34mhttps://blog.runpod.io/\033[0m\n\n"' >> /root/.bashrc
|
||||||
|
|
||||||
|
# Set the default command for the container
|
||||||
|
CMD [ "/start.sh" ]
|
7
better-base/README.md
Normal file
7
better-base/README.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
## Build Options
|
||||||
|
|
||||||
|
To build with default options, run `docker buildx bake`, to build a specific target, run `docker buildx bake <target>`.
|
||||||
|
|
||||||
|
## Ports
|
||||||
|
|
||||||
|
- 22/tcp (SSH)
|
45
better-base/docker-bake.hcl
Normal file
45
better-base/docker-bake.hcl
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
group "default" {
|
||||||
|
targets = ["py310-cuda121", "py310-cuda118", "py310-cuda124"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "py310-cuda121" {
|
||||||
|
contexts = {
|
||||||
|
scripts = "../../container-template"
|
||||||
|
proxy = "../../container-template/proxy"
|
||||||
|
logo = "../../container-template"
|
||||||
|
}
|
||||||
|
dockerfile = "Dockerfile"
|
||||||
|
args = {
|
||||||
|
BASE_IMAGE = "nvidia/cuda:12.1.0-cudnn8-devel-ubuntu22.04",
|
||||||
|
PYTHON_VERSION = "3.10"
|
||||||
|
}
|
||||||
|
tags = ["madiator2011/better-base:cuda12.1"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "py310-cuda118" {
|
||||||
|
contexts = {
|
||||||
|
scripts = "../../container-template"
|
||||||
|
proxy = "../../container-template/proxy"
|
||||||
|
logo = "../../container-template"
|
||||||
|
}
|
||||||
|
dockerfile = "Dockerfile"
|
||||||
|
args = {
|
||||||
|
BASE_IMAGE = "nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04",
|
||||||
|
PYTHON_VERSION = "3.10"
|
||||||
|
}
|
||||||
|
tags = ["madiator2011/better-base:cuda11.8"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "py310-cuda124" {
|
||||||
|
contexts = {
|
||||||
|
scripts = "../../container-template"
|
||||||
|
proxy = "../../container-template/proxy"
|
||||||
|
logo = "../../container-template"
|
||||||
|
}
|
||||||
|
dockerfile = "Dockerfile"
|
||||||
|
args = {
|
||||||
|
BASE_IMAGE = "nvidia/cuda:12.4.1-cudnn-devel-ubuntu22.04",
|
||||||
|
PYTHON_VERSION = "3.10"
|
||||||
|
}
|
||||||
|
tags = ["madiator2011/better-base:cuda12.4"]
|
||||||
|
}
|
18
better-base/settings.json
Normal file
18
better-base/settings.json
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"workbench.colorTheme": "Default Dark Modern",
|
||||||
|
"workbench.startupEditor": "none",
|
||||||
|
"workbench.enableExperiments": false,
|
||||||
|
"telemetry.enableTelemetry": false,
|
||||||
|
"telemetry.enableCrashReporter": false,
|
||||||
|
"security.workspace.trust.enabled": false,
|
||||||
|
"update.mode": "manual",
|
||||||
|
"extensions.autoUpdate": false,
|
||||||
|
"python.showStartPage": false,
|
||||||
|
"jupyter.experiments.enabled": false,
|
||||||
|
"jupyter.askForKernelRestart": false,
|
||||||
|
"jupyter.askForKernelSource": false,
|
||||||
|
"jupyter.alwaysTrustNotebooks": true,
|
||||||
|
"extensions.ignoreRecommendations": true,
|
||||||
|
"files.autoSave": "afterDelay",
|
||||||
|
"files.autoSaveDelay": 1000
|
||||||
|
}
|
Loading…
Reference in a new issue