|
1 | | -# Container for running Vivado on M1/M2 macs |
2 | | -# though it should work equally on Intel macs |
3 | | -FROM --platform=linux/amd64 ubuntu:22.04 |
4 | | -RUN apt-get update && apt-get upgrade -y |
5 | | - |
6 | | -# Fix the error of build failing due to not having the frontend installed |
7 | | -# This enviroment auto fallbacks to noninteractive mode, with the declaration following this guidance: |
8 | | -# https://bobcares.com/blog/debian_frontendnoninteractive-docker/ |
9 | | -# https://github.com/moby/moby/issues/4032#issuecomment-34597177 |
| 1 | +# Container for running Vivado on Apple Silicon (M1/M2/M3/M4) Macs. |
| 2 | +# Uses linux/amd64 platform accelerated by Rosetta 2 via the Apple Virtualization Framework. |
| 3 | +FROM --platform=linux/amd64 ubuntu:24.04 |
| 4 | + |
| 5 | +# Prevent interactive prompts during package installation |
10 | 6 | ARG DEBIAN_FRONTEND=noninteractive |
11 | 7 |
|
12 | | -# Check and install ca-certificates earlier if Rosetta gets broken |
13 | | -RUN apt -y install ca-certificates |
14 | | - |
15 | | -# install gui |
16 | | -RUN apt-get install -y --no-install-recommends \ |
17 | | - dbus dbus-x11 x11-utils xorg alsa-utils mesa-utils net-tools \ |
18 | | - libgl1-mesa-dri gtk2-engines lxappearance fonts-droid-fallback sudo firefox \ |
19 | | - ubuntu-gnome-default-settings curl gnupg lxde arc-theme \ |
20 | | - gtk2-engines-murrine gtk2-engines-pixbuf gnome-themes-standard nano xterm |
21 | | - |
22 | | -# install dependencies for Vivado |
23 | | -RUN apt-get install -y --no-install-recommends \ |
24 | | - python3-pip python3-dev build-essential git gcc-multilib g++ \ |
25 | | - ocl-icd-opencl-dev libjpeg62-dev libc6-dev-i386 graphviz make \ |
26 | | - unzip libtinfo5 xvfb libncursesw5 locales libswt-gtk-4-jni |
27 | | - |
28 | | -# install vnc server (with recommended installs) |
29 | | -RUN apt-get install -y \ |
30 | | - tigervnc-standalone-server tigervnc-xorg-extension |
31 | | - |
32 | | -# create user "user" with password "password" |
33 | | -RUN useradd --create-home --shell /bin/bash --user-group --groups adm,sudo user |
34 | | -RUN sh -c 'echo "user:password" | chpasswd' |
35 | | -# RUN cp -r /root/{.config,.gtkrc-2.0,.asoundrc} /home/user |
36 | | -RUN chown -R user:user /home/user |
37 | | -# setup LXDE |
38 | | -RUN mkdir -p /home/user/.config/pcmanfm/LXDE/ |
39 | | -RUN ln -sf /usr/local/share/doro-lxde-wallpapers/desktop-items-0.conf \ |
40 | | - /home/user/.config/pcmanfm/LXDE/ |
41 | | -RUN mv /usr/bin/lxpolkit /usr/bin/lxpolkit.bak |
42 | | -#RUN echo "" >> /etc/xdg/lxsession/LXDE/autostart |
43 | | -#RUN echo "@lxterminal -e /home/user/scripts/de_start.sh" >> /etc/xdg/lxsession/LXDE/autostart |
44 | | -# setup TigerVNC |
45 | | -RUN sed -i 's/-iconic/-nowin/g' /etc/X11/Xtigervnc-session |
46 | | -RUN mkdir /home/user/.vnc |
47 | | -RUN echo "password" | vncpasswd -f > /vncpasswd |
48 | | -RUN chown user /vncpasswd |
49 | | -RUN chmod 600 /vncpasswd |
50 | | - |
51 | | -# Set the locale, because Vivado crashes otherwise |
52 | | -RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \ |
53 | | - locale-gen |
| 8 | +# Install ALL packages in a single layer and clean up immediately to keep the |
| 9 | +# image well under 8 GiB. Package notes for Ubuntu 24.04: |
| 10 | +# - libtinfo5 / libncursesw5 are gone → replaced by libtinfo6 / libncursesw6 |
| 11 | +# (backward-compat symlinks are created in the next step) |
| 12 | +# - libjpeg62-dev is gone → replaced by libjpeg-dev |
| 13 | +# - libgtk2.0-0 is now libgtk2.0-0t64 (64-bit time_t transition) |
| 14 | +# - firefox removed (large, not needed inside the container) |
| 15 | +# - libswt-gtk-4-jni removed (bundled inside Vivado 2025.x) |
| 16 | +RUN apt-get update && \ |
| 17 | + apt-get install -y --no-install-recommends \ |
| 18 | + # Core utilities |
| 19 | + ca-certificates curl gnupg sudo nano \ |
| 20 | + # D-Bus and X11 infrastructure |
| 21 | + dbus dbus-x11 x11-utils xorg xvfb net-tools \ |
| 22 | + # OpenGL / display |
| 23 | + libgl1-mesa-dri libglu1-mesa \ |
| 24 | + # Lightweight desktop (LXDE) and supporting themes/tools |
| 25 | + lxde lxappearance lxterminal xterm \ |
| 26 | + gtk2-engines-murrine gtk2-engines-pixbuf \ |
| 27 | + gnome-themes-extra \ |
| 28 | + # Audio support |
| 29 | + alsa-utils \ |
| 30 | + # Vivado build and runtime dependencies |
| 31 | + python3-pip python3-dev build-essential git \ |
| 32 | + gcc-multilib g++ \ |
| 33 | + ocl-icd-opencl-dev libjpeg-dev libc6-dev-i386 \ |
| 34 | + graphviz make unzip \ |
| 35 | + # ncurses / terminal libs (Ubuntu 24.04 names) |
| 36 | + libtinfo6 libncurses6 libncursesw6 \ |
| 37 | + # GTK2 runtime required by Vivado GUI (t64 transition package in 24.04) |
| 38 | + libgtk2.0-0t64 \ |
| 39 | + # Locale support (Vivado crashes without a proper locale) |
| 40 | + locales \ |
| 41 | + # TigerVNC server for remote GUI access |
| 42 | + # tigervnc-tools is required explicitly — it provides vncpasswd in Ubuntu 24.04 |
| 43 | + tigervnc-standalone-server tigervnc-xorg-extension tigervnc-tools \ |
| 44 | + && apt-get clean \ |
| 45 | + && rm -rf /var/lib/apt/lists/* |
| 46 | + |
| 47 | +# Create backward-compatible symlinks so that Vivado binaries that reference |
| 48 | +# the old .so.5 names still resolve correctly under Ubuntu 24.04. |
| 49 | +RUN ln -sf /lib/x86_64-linux-gnu/libtinfo.so.6 /lib/x86_64-linux-gnu/libtinfo.so.5 && \ |
| 50 | + ln -sf /lib/x86_64-linux-gnu/libncursesw.so.6 /lib/x86_64-linux-gnu/libncursesw.so.5 |
| 51 | + |
| 52 | +# Create user "user" with password "password". |
| 53 | +# The password is intentionally weak — the VNC server only accepts connections |
| 54 | +# from the macOS host (127.0.0.1 binding in the docker run command). |
| 55 | +RUN useradd --create-home --shell /bin/bash --user-group --groups adm,sudo user && \ |
| 56 | + echo "user:password" | chpasswd && \ |
| 57 | + chown -R user:user /home/user |
| 58 | + |
| 59 | +# Setup LXDE desktop configuration |
| 60 | +RUN mkdir -p /home/user/.config/pcmanfm/LXDE/ && \ |
| 61 | + if [ -f /usr/local/share/doro-lxde-wallpapers/desktop-items-0.conf ]; then \ |
| 62 | + ln -sf /usr/local/share/doro-lxde-wallpapers/desktop-items-0.conf \ |
| 63 | + /home/user/.config/pcmanfm/LXDE/; \ |
| 64 | + fi && \ |
| 65 | + # Disable lxpolkit to prevent authentication pop-ups on desktop start |
| 66 | + if [ -f /usr/bin/lxpolkit ]; then mv /usr/bin/lxpolkit /usr/bin/lxpolkit.bak; fi |
| 67 | + |
| 68 | +# Setup TigerVNC |
| 69 | +RUN sed -i 's/-iconic/-nowin/g' /etc/X11/Xtigervnc-session && \ |
| 70 | + mkdir -p /home/user/.vnc && \ |
| 71 | + echo "password" | vncpasswd -f > /vncpasswd && \ |
| 72 | + chown user /vncpasswd && \ |
| 73 | + chmod 600 /vncpasswd |
| 74 | + |
| 75 | +# Generate locale — Vivado crashes at startup without en_US.UTF-8 |
| 76 | +RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen |
54 | 77 | ENV LANG=en_US.UTF-8 |
55 | 78 | ENV LANGUAGE=en_US:en |
56 | 79 | ENV LC_ALL=en_US.UTF-8 |
57 | 80 |
|
58 | | -# Without this, Vivado will crash when synthesizing |
59 | | -ENV LD_PRELOAD="/lib/x86_64-linux-gnu/libudev.so.1 /lib/x86_64-linux-gnu/libselinux.so.1 /lib/x86_64-linux-gnu/libz.so.1 /lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0" |
| 81 | +# Cap Java heap at 4 GiB. |
| 82 | +# Vivado and its installer are Java-based. Without a limit the JVM can |
| 83 | +# claim far more than available RAM, causing OOM kills inside the container. |
| 84 | +# JAVA_TOOL_OPTIONS is the portable, standard variable respected by all |
| 85 | +# JVM implementations (Java 8+). |
| 86 | +ENV JAVA_TOOL_OPTIONS="-Xmx4096m -Xms512m" |
| 87 | + |
| 88 | +# LD_PRELOAD workaround for Vivado stability under Rosetta 2. |
| 89 | +# - libudev / libselinux / libz: prevent crashes during synthesis |
| 90 | +# - libgdk-x11-2.0: prevents GUI crashes on startup |
| 91 | +# NOTE: libgdk moved to /usr/lib in Ubuntu 24.04 (libgtk2.0-0t64 package). |
| 92 | +# de_start.sh resolves the exact path at runtime to handle any layout variation. |
| 93 | +ENV LD_PRELOAD="/lib/x86_64-linux-gnu/libudev.so.1 /lib/x86_64-linux-gnu/libselinux.so.1 /lib/x86_64-linux-gnu/libz.so.1" |
| 94 | + |
0 commit comments