-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Charlie Drage <[email protected]>
- Loading branch information
Showing
3 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# **Description:** | ||
# | ||
# This is a "hello world" GPU container that showcases | ||
# how we can use the Mac Silicon GPU within a container. | ||
# | ||
# You must use Podman Desktop with Podman 5.2.0 or above and run a | ||
# podman machine with libkrun support. | ||
# | ||
# For a more technical TLDR it is: | ||
# * Creates a virtualized Vulkan GPU interface | ||
# * Virtualized GPU is passed to a vulkan-to-metal layer on the host MacOS | ||
# * Uses https://github.com/containers/libkrun for all of this to work. | ||
# | ||
# Source code: | ||
# In order for this to work, a patched version of mesa / vulkan | ||
# | ||
# **Running:** | ||
# | ||
# ```sh | ||
# podman run -d \ | ||
# -p 8080:8080 \ | ||
# --name rickroll \ | ||
# ghcr.io/cdrage/rickroll | ||
# ``` | ||
|
||
FROM fedora:40 | ||
USER 0 | ||
RUN dnf -y install dnf-plugins-core && \ | ||
dnf -y copr enable slp/mesa-krunkit && \ | ||
dnf -y install mesa-vulkan-drivers vulkan-loader-devel vulkan-headers vulkan-loader vulkan-tools && \ | ||
dnf clean all | ||
|
||
# Install necessary packages including X11, VNC server, noVNC, and Vulkan tools | ||
RUN dnf -y install dnf-plugins-core xorg-x11-server-Xvfb tigervnc-server \ | ||
novnc vulkan-headers vulkan-loader vulkan-tools && \ | ||
dnf -y copr enable slp/mesa-krunkit && \ | ||
dnf clean all | ||
|
||
# Set up a VNC password | ||
#RUN mkdir -p ~/.vnc && \ | ||
#echo "password" | vncpasswd -f > ~/.vnc/passwd && \ | ||
#chmod 600 ~/.vnc/passwd | ||
|
||
|
||
RUN dnf install git -y | ||
|
||
RUN dnf install procps -y | ||
# Clone and set up noVNC | ||
RUN git clone https://github.com/novnc/noVNC.git /opt/noVNC && \ | ||
git clone https://github.com/novnc/websockify /opt/noVNC/utils/websockify && \ | ||
ln -s /opt/noVNC/utils/novnc_proxy /usr/local/bin/novnc_proxy | ||
|
||
# Create a symlink in the noVNC directory to server index by default | ||
RUN ln -s /opt/noVNC/vnc.html /opt/noVNC/index.html | ||
|
||
# Expose the noVNC port | ||
EXPOSE 6080 5900 80 | ||
|
||
# Start VNC server using systemd | ||
#RUN systemctl enable vncserver@:1.service | ||
|
||
RUN dnf install hostname -y | ||
|
||
# Copy the startup script into the container | ||
COPY startup.sh /usr/local/bin/startup.sh | ||
|
||
# Make the script executable | ||
RUN chmod +x /usr/local/bin/startup.sh | ||
|
||
# Set the default command to start everything | ||
CMD ["/usr/local/bin/startup.sh"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
# Start Xvfb | ||
#Xvfb :0 -screen 0 1024x768x24 -nolisten tcp & | ||
|
||
#sleep 2 | ||
|
||
# Set DISPLAY environment variable | ||
export DISPLAY=:1 | ||
|
||
# Start VNC server with no password | ||
vncserver :1 -geometry 1024x768 -localhost -SecurityTypes None & | ||
sleep 1 | ||
#/usr/share/novnc/utils/novnc_proxy --vnc localhost:5901 &> /var/log/novnc.log & | ||
/usr/local/bin/novnc_proxy --vnc localhost:5901 --listen 6080 & | ||
|
||
nginx | ||
|
||
export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/lvp_icd.aarch64.json | ||
|
||
sleep 5 | ||
vkcube |