Update Linux Dockerfile

This commit is contained in:
ddutchie 2024-03-15 14:14:09 +00:00
parent 5172389ec1
commit e3aa4ab18b

View file

@ -1,163 +1,163 @@
FROM ubuntu:20.04 FROM ubuntu:20.04
LABEL maintainer="suyu" LABEL maintainer="suyu"
ENV BOOST_VER=1_79_0 ENV BOOST_VER=1_79_0
ENV CLANG_VER=14 ENV CLANG_VER=14
ENV CMAKE_VER=3.22.6 ENV CMAKE_VER=3.22.6
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
ENV GCC_VER=12.2.0 ENV GCC_VER=12.2.0
ENV GNU_BIN_VER=2.40 ENV GNU_BIN_VER=2.40
ENV QT_PKG_VER=515 ENV QT_PKG_VER=515
ENV QT_VER=5.15.2 ENV QT_VER=5.15.2
ENV UBUNTU_VER=focal ENV UBUNTU_VER=focal
# Create a user account suyu (UID 1027) that the container will run as # Create a user account suyu (UID 1027) that the container will run as
RUN useradd -m -u 1027 -s /bin/bash suyu && \ RUN useradd -m -u 1027 -s /bin/bash suyu && \
apt-get update && \ apt-get update && \
apt-get full-upgrade -y && \ apt-get full-upgrade -y && \
apt-get install --no-install-recommends -y \ apt-get install --no-install-recommends -y \
apt-utils \ apt-utils \
ca-certificates \ ca-certificates \
gnupg \ gnupg \
software-properties-common \ software-properties-common \
unzip \ unzip \
wget \ wget \
xz-utils \ xz-utils \
# suyu build requirements # suyu build requirements
build-essential \ build-essential \
ccache \ ccache \
git \ git \
libgl-dev \ libgl-dev \
liblz4-dev \ liblz4-dev \
libpulse-dev \ libpulse-dev \
libudev-dev \ libudev-dev \
libssl-dev \ libssl-dev \
libtool \ libtool \
libwayland-dev \ libwayland-dev \
ninja-build \ ninja-build \
pkg-config \ pkg-config \
zlib1g-dev \ zlib1g-dev \
# AppImage support # AppImage support
appstream \ appstream \
desktop-file-utils \ desktop-file-utils \
file \ file \
libfile-mimeinfo-perl \ libfile-mimeinfo-perl \
patchelf \ patchelf \
zsync \ zsync \
# FFmpeg build requirements # FFmpeg build requirements
libdrm-dev \ libdrm-dev \
libva-dev \ libva-dev \
libx11-dev \ libx11-dev \
libxext-dev \ libxext-dev \
nasm \ nasm \
# libusb build requirements # libusb build requirements
autoconf \ autoconf \
automake \ automake \
libtool \ libtool \
libudev-dev \ libudev-dev \
# apt.llvm.org Clang requirements # apt.llvm.org Clang requirements
gpg-agent \ gpg-agent \
# vcpkg requirements # vcpkg requirements
curl \ curl \
zip \ zip \
&& \ && \
# Install updated versions of glslang, git, and Qt from launchpad repositories # Install updated versions of glslang, git, and Qt from launchpad repositories
add-apt-repository -y ppa:beineri/opt-qt-${QT_VER}-${UBUNTU_VER} && \ add-apt-repository -y ppa:beineri/opt-qt-${QT_VER}-${UBUNTU_VER} && \
add-apt-repository -y ppa:savoury1/graphics && \ add-apt-repository -y ppa:savoury1/graphics && \
add-apt-repository -y ppa:savoury1/multimedia && \ add-apt-repository -y ppa:savoury1/multimedia && \
add-apt-repository -y ppa:savoury1/ffmpeg4 && \ add-apt-repository -y ppa:savoury1/ffmpeg4 && \
add-apt-repository -y ppa:git-core/ppa && \ add-apt-repository -y ppa:git-core/ppa && \
apt-get update -y && \ apt-get update -y && \
apt-get install --no-install-recommends -y \ apt-get install --no-install-recommends -y \
git \ git \
glslang-dev \ glslang-dev \
glslang-tools \ glslang-tools \
libhidapi-dev \ libhidapi-dev \
qt${QT_PKG_VER}base \ qt${QT_PKG_VER}base \
qt${QT_PKG_VER}tools \ qt${QT_PKG_VER}tools \
qt${QT_PKG_VER}wayland \ qt${QT_PKG_VER}wayland \
qt${QT_PKG_VER}multimedia \ qt${QT_PKG_VER}multimedia \
qt${QT_PKG_VER}x11extras && \ qt${QT_PKG_VER}x11extras && \
# Install Clang from apt.llvm.org # Install Clang from apt.llvm.org
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \ wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \
echo "deb http://apt.llvm.org/${UBUNTU_VER}/ llvm-toolchain-${UBUNTU_VER}-${CLANG_VER} main" >> /etc/apt/sources.list && \ echo "deb http://apt.llvm.org/${UBUNTU_VER}/ llvm-toolchain-${UBUNTU_VER}-${CLANG_VER} main" >> /etc/apt/sources.list && \
apt-get update -y && \ apt-get update -y && \
apt-get install --no-install-recommends -y \ apt-get install --no-install-recommends -y \
clang-${CLANG_VER} \ clang-${CLANG_VER} \
lld-${CLANG_VER} \ lld-${CLANG_VER} \
llvm-${CLANG_VER} \ llvm-${CLANG_VER} \
llvm-${CLANG_VER}-linker-tools && \ llvm-${CLANG_VER}-linker-tools && \
ln -s $(which clang-${CLANG_VER}) /usr/bin/clang && \ ln -s $(which clang-${CLANG_VER}) /usr/bin/clang && \
ln -s $(which clang++-${CLANG_VER}) /usr/bin/clang++ && \ ln -s $(which clang++-${CLANG_VER}) /usr/bin/clang++ && \
dpkg-reconfigure ccache && \ dpkg-reconfigure ccache && \
apt-get clean autoclean && \ apt-get clean autoclean && \
apt-get autoremove --yes && \ apt-get autoremove --yes && \
rm -rf /var/lib/apt /var/lib/dpkg /var/lib/cache /var/lib/log rm -rf /var/lib/apt /var/lib/dpkg /var/lib/cache /var/lib/log
# Install CMake from upstream # Install CMake from upstream
RUN cd /tmp && \ RUN cd /tmp && \
wget --no-verbose https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/cmake-${CMAKE_VER}-linux-x86_64.tar.gz && \ wget --no-verbose https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/cmake-${CMAKE_VER}-linux-x86_64.tar.gz && \
tar xvf cmake-${CMAKE_VER}-linux-x86_64.tar.gz && \ tar xvf cmake-${CMAKE_VER}-linux-x86_64.tar.gz && \
cp -rv cmake-${CMAKE_VER}-linux-x86_64/* /usr && \ cp -rv cmake-${CMAKE_VER}-linux-x86_64/* /usr && \
rm -rf cmake-* rm -rf cmake-*
# Install Boost from suyu-emu/ext-linux-bin # Install Boost from suyu-emu/ext-linux-bin
RUN cd /tmp && \ RUN cd /tmp && \
wget --no-verbose https://github.com/suyu-emu/ext-linux-bin/raw/main/boost/boost-${BOOST_VER}.tar.xz && \ wget --no-verbose https://github.com/suyu-emu/ext-linux-bin/raw/main/boost/boost-${BOOST_VER}.tar.xz && \
tar xvf boost-${BOOST_VER}.tar.xz && \ tar xvf boost-${BOOST_VER}.tar.xz && \
chown -R root:root boost-${BOOST_VER}/ && \ chown -R root:root boost-${BOOST_VER}/ && \
cp -rv boost-${BOOST_VER}/usr / && \ cp -rv boost-${BOOST_VER}/usr / && \
rm -rf boost* rm -rf boost*
# Install GCC from suyu-emu/ext-linux-bin # Install GCC from suyu-emu/ext-linux-bin
RUN cd /tmp && \ RUN cd /tmp && \
wget --no-verbose \ wget --no-verbose \
https://github.com/suyu-emu/ext-linux-bin/raw/main/gcc/gcc-${GCC_VER}-ubuntu.tar.xz.aa \ https://gitlab.com/suyu-emu/ext-linux-bin/raw/main/gcc/gcc-${GCC_VER}-ubuntu.tar.xz.aa \
https://github.com/suyu-emu/ext-linux-bin/raw/main/gcc/gcc-${GCC_VER}-ubuntu.tar.xz.ab \ https://gitlab.com/suyu-emu/ext-linux-bin/raw/main/gcc/gcc-${GCC_VER}-ubuntu.tar.xz.ab \
https://github.com/suyu-emu/ext-linux-bin/raw/main/gcc/gcc-${GCC_VER}-ubuntu.tar.xz.ac \ https://gitlab.com/suyu-emu/ext-linux-bin/raw/main/gcc/gcc-${GCC_VER}-ubuntu.tar.xz.ac \
https://github.com/suyu-emu/ext-linux-bin/raw/main/gcc/gcc-${GCC_VER}-ubuntu.tar.xz.ad && \ https://gitlab.com/suyu-emu/ext-linux-bin/raw/main/gcc/gcc-${GCC_VER}-ubuntu.tar.xz.ad && \
cat gcc-${GCC_VER}-ubuntu.tar.xz.* | tar xJ && \ cat gcc-${GCC_VER}-ubuntu.tar.xz.* | tar xJ && \
cp -rv gcc-${GCC_VER}/usr / && \ cp -rv gcc-${GCC_VER}/usr / && \
rm -rf /tmp/gcc* && \ rm -rf /tmp/gcc* && \
# Use updated libstdc++ and libgcc_s on the container from GCC 11 # Use updated libstdc++ and libgcc_s on the container from GCC 11
rm -v /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /lib/x86_64-linux-gnu/libgcc_s.so.1 && \ rm -v /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /lib/x86_64-linux-gnu/libgcc_s.so.1 && \
ln -sv /usr/local/lib64/libstdc++.so.6.0.30 /usr/lib/x86_64-linux-gnu/libstdc++.so.6 && \ ln -sv /usr/local/lib64/libstdc++.so.6.0.30 /usr/lib/x86_64-linux-gnu/libstdc++.so.6 && \
ln -sv /usr/local/lib64/libgcc_s.so.1 /lib/x86_64-linux-gnu/libgcc_s.so.1 && \ ln -sv /usr/local/lib64/libgcc_s.so.1 /lib/x86_64-linux-gnu/libgcc_s.so.1 && \
# Help Clang find the updated GCC C++ version # Help Clang find the updated GCC C++ version
ln -sv /usr/local/include/c++/${GCC_VER}/ /usr/include/c++/${GCC_VER} && \ ln -sv /usr/local/include/c++/${GCC_VER}/ /usr/include/c++/${GCC_VER} && \
ln -sv /usr/local/lib/gcc/x86_64-pc-linux-gnu/${GCC_VER} /usr/lib/gcc/x86_64-linux-gnu/${GCC_VER} && \ ln -sv /usr/local/lib/gcc/x86_64-pc-linux-gnu/${GCC_VER} /usr/lib/gcc/x86_64-linux-gnu/${GCC_VER} && \
cp -rv /usr/local/include/c++/${GCC_VER}/x86_64-pc-linux-gnu/* /usr/local/include/c++/${GCC_VER}/ cp -rv /usr/local/include/c++/${GCC_VER}/x86_64-pc-linux-gnu/* /usr/local/include/c++/${GCC_VER}/
# Install GNU binutils from suyu-emu/ext-linux-bin # Install GNU binutils from suyu-emu/ext-linux-bin
RUN cd /tmp && \ RUN cd /tmp && \
wget --no-verbose \ wget --no-verbose \
https://github.com/suyu-emu/ext-linux-bin/raw/main/binutils/binutils-${GNU_BIN_VER}-${UBUNTU_VER}.tar.xz && \ https://gitlab.com/suyu-emu/ext-linux-bin/raw/main/binutils/binutils-${GNU_BIN_VER}-${UBUNTU_VER}.tar.xz && \
tar xf binutils-${GNU_BIN_VER}-${UBUNTU_VER}.tar.xz && \ tar xf binutils-${GNU_BIN_VER}-${UBUNTU_VER}.tar.xz && \
cp -rv binutils-${GNU_BIN_VER}-${UBUNTU_VER}/usr / && \ cp -rv binutils-${GNU_BIN_VER}-${UBUNTU_VER}/usr / && \
rm -rf /tmp/binutils* rm -rf /tmp/binutils*
# Setup paths for Qt binaries # Setup paths for Qt binaries
ENV LD_LIBRARY_PATH=/opt/qt${QT_PKG_VER}/lib:${LD_LIBRARY_PATH} ENV LD_LIBRARY_PATH=/opt/qt${QT_PKG_VER}/lib:${LD_LIBRARY_PATH}
ENV PATH=/opt/qt${QT_PKG_VER}/bin:${PATH} ENV PATH=/opt/qt${QT_PKG_VER}/bin:${PATH}
# Fix GCC 11 <-> Qt 5.15 issue # Fix GCC 11 <-> Qt 5.15 issue
COPY qtconcurrentthreadengine.patch /opt/qt515/qtconcurrentthreadengine.patch COPY qtconcurrentthreadengine.patch /opt/qt515/qtconcurrentthreadengine.patch
RUN patch /opt/qt515/include/QtConcurrent/qtconcurrentthreadengine.h /opt/qt515/qtconcurrentthreadengine.patch && \ RUN patch /opt/qt515/include/QtConcurrent/qtconcurrentthreadengine.h /opt/qt515/qtconcurrentthreadengine.patch && \
rm /opt/qt515/qtconcurrentthreadengine.patch rm /opt/qt515/qtconcurrentthreadengine.patch
# Tell CMake to use vcpkg when looking for packages # Tell CMake to use vcpkg when looking for packages
ENV VCPKG_TOOLCHAIN_FILE=/home/suyu/vcpkg/scripts/buildsystems/vcpkg.cmake ENV VCPKG_TOOLCHAIN_FILE=/home/suyu/vcpkg/scripts/buildsystems/vcpkg.cmake
USER 1027 USER 1027
# Install vcpkg and required dependencies for suyu # Install vcpkg and required dependencies for suyu
RUN cd /home/suyu &&\ RUN cd /home/suyu &&\
git clone --depth 1 https://github.com/Microsoft/vcpkg.git &&\ git clone --depth 1 https://github.com/Microsoft/vcpkg.git &&\
cd vcpkg &&\ cd vcpkg &&\
./bootstrap-vcpkg.sh &&\ ./bootstrap-vcpkg.sh &&\
./vcpkg install \ ./vcpkg install \
catch2 \ catch2 \
fmt \ fmt \
lz4 \ lz4 \
nlohmann-json \ nlohmann-json \
zlib \ zlib \
zstd zstd