Skip to content

Instantly share code, notes, and snippets.

@cs50victor
Created February 23, 2025 18:44
Show Gist options
  • Select an option

  • Save cs50victor/bbfcf59bd11e75c36fcfcaf06f346d09 to your computer and use it in GitHub Desktop.

Select an option

Save cs50victor/bbfcf59bd11e75c36fcfcaf06f346d09 to your computer and use it in GitHub Desktop.
Dockerfile to enable vulkan using Nvidia on fly.io
FROM nvidia/cuda:12.2.2-base-ubuntu22.04
ENV NVIDIA_DRIVER_CAPABILITIES=compute,graphics,vulkan,utility
ENV NVIDIA_VISIBLE_DEVICES=all
ENV DEBIAN_FRONTEND=noninteractive
ENV VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json
RUN sed -i 's/ main$/ main contrib non-free/g' /etc/apt/sources.list
RUN apt-get update -y && apt-get install -y \
curl \
build-essential \
ca-certificates \
nvidia-driver-565 libnvidia-extra-565 \
libasound2-dev \
xorg \
libx11-dev \
libxkbcommon-dev \
libnvidia-extra-565 \
libvulkan-dev \
vulkan-tools \
vulkan-validationlayers \
vulkan-validationlayers-dev \
libvulkan1 \
libxkbcommon0 \
libglib2.0-0 \
libxext6 \
libxkbcommon0 python-is-python3 \
pkg-config && \
apt-get purge -y mesa-* libgl1* && \
# apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly
# ------- REPLACE THIS WITH YOUR CODE THAT DEPENDS ON VULKAN
WORKDIR /app
COPY . .
RUN /root/.cargo/bin/cargo build --release
ENTRYPOINT ["/app/target/release/xxx"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment