From 4fb8024b04280ac1bd07bd1b00453d714684bdb2 Mon Sep 17 00:00:00 2001 From: liushuyu Date: Wed, 23 Aug 2023 12:21:48 -0600 Subject: [PATCH] docker: use Ubuntu chisel image ... ... and also update patches --- Dockerfile | 57 ++++++++++++++++++++++++---- patches/0001-bypass-extra-deps.patch | 22 +++++------ 2 files changed, 61 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index 298830f..11a4689 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,65 @@ # syntax=docker/dockerfile:1.3 -FROM debian:bullseye AS build +ARG UBUNTU_RELEASE=23.04 +ARG USER=ubuntu UID=101 GROUP=ubuntu GID=101 + +### BOILERPLATE BEGIN ### + +FROM golang:1.20 AS chisel +ARG UBUNTU_RELEASE +RUN git clone -b ubuntu-${UBUNTU_RELEASE} https://github.com/canonical/chisel-releases /opt/chisel-releases \ + && git clone --depth 1 -b main https://github.com/canonical/chisel /opt/chisel +WORKDIR /opt/chisel +RUN go generate internal/deb/version.go \ + && go build ./cmd/chisel + +FROM ubuntu:$UBUNTU_RELEASE AS builder +SHELL ["/bin/bash", "-oeux", "pipefail", "-c"] +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y ca-certificates \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/* +COPY --from=chisel /opt/chisel/chisel /usr/bin/ + +FROM builder AS rootfs-prep +ARG USER UID GROUP GID +RUN mkdir -p /rootfs/etc \ + && echo "$GROUP:x:$GID:" >/rootfs/etc/group \ + && echo "$USER:x:$UID:$GID::/nohome:/noshell" >/rootfs/etc/passwd + +FROM scratch AS image-prep +ARG UID GID +USER $UID:$GID + +### BOILERPLATE END ### + +FROM ubuntu:$UBUNTU_RELEASE AS build ENV DEBIAN_FRONTEND=noninteractive ARG USE_CCACHE -RUN echo "deb http://deb.debian.org/debian bullseye-backports main" >> /etc/apt/sources.list && \ - apt-get update && apt-get -y full-upgrade && \ +RUN apt-get update && apt-get -y full-upgrade && \ apt-get install -y build-essential wget git ccache ninja-build libssl-dev pkg-config libarchive-tools \ - cmake/bullseye-backports cmake-data/bullseye-backports - + cmake cmake-data COPY . /root/build-files RUN --mount=type=cache,id=ccache,target=/root/.ccache \ git clone --depth 1000 -j4 --recursive https://github.com/yuzu-emu/yuzu-mainline.git /root/yuzu-mainline && \ cd /root/yuzu-mainline && /root/build-files/.ci/build.sh -FROM gcr.io/distroless/cc-debian11 AS final +FROM rootfs-prep AS sliced-deps +COPY --from=chisel /opt/chisel-releases /opt/chisel-releases +RUN chisel cut --release /opt/chisel-releases --root /rootfs \ + base-files_base \ + base-files_release-info \ + ca-certificates_data \ + libgcc-s1_libs \ + libc6_libs \ + libssl3_libs \ + libstdc++6_libs \ + openssl_config + +FROM image-prep AS final +COPY --from=sliced-deps /rootfs / LABEL maintainer="yuzuemu" # Create app directory WORKDIR /usr/src/app COPY --from=build /root/yuzu-mainline/build/bin/yuzu-room /usr/src/app - ENTRYPOINT [ "/usr/src/app/yuzu-room" ] diff --git a/patches/0001-bypass-extra-deps.patch b/patches/0001-bypass-extra-deps.patch index f6c7d68..2e0b9ba 100644 --- a/patches/0001-bypass-extra-deps.patch +++ b/patches/0001-bypass-extra-deps.patch @@ -1,4 +1,4 @@ -From c379fce1746b73485ec5053c56aed670f652f4e5 Mon Sep 17 00:00:00 2001 +From 432376920da73e5bb1dc3462c9e92c88607f7d75 Mon Sep 17 00:00:00 2001 From: liushuyu Date: Mon, 15 Aug 2022 23:32:31 -0600 Subject: [PATCH] build: bypass extra dependency checks @@ -10,10 +10,10 @@ Subject: [PATCH] build: bypass extra dependency checks 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt -index 7f0a6d069..e9c583e22 100644 +index 1f7cd598e..649b23ae9 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt -@@ -131,7 +131,7 @@ endif() +@@ -128,7 +128,7 @@ endif() # FFMpeg if (YUZU_USE_BUNDLED_FFMPEG) @@ -23,27 +23,27 @@ index 7f0a6d069..e9c583e22 100644 set(FFmpeg_LDFLAGS "${FFmpeg_LDFLAGS}" PARENT_SCOPE) set(FFmpeg_LIBRARIES "${FFmpeg_LIBRARIES}" PARENT_SCOPE) diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt -index d7f7d336c..8bd187523 100644 +index 9b13ccbab..c4a5c25f6 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt -@@ -245,9 +245,9 @@ create_target_directory_groups(video_core) +@@ -284,9 +284,9 @@ create_target_directory_groups(video_core) target_link_libraries(video_core PUBLIC common core) - target_link_libraries(video_core PUBLIC glad shader_recompiler) + target_link_libraries(video_core PUBLIC glad shader_recompiler stb bc_decoder) --if (YUZU_USE_BUNDLED_FFMPEG AND NOT WIN32) +-if (YUZU_USE_BUNDLED_FFMPEG AND NOT (WIN32 OR ANDROID)) - add_dependencies(video_core ffmpeg-build) -endif() -+#if (YUZU_USE_BUNDLED_FFMPEG AND NOT WIN32) ++#if (YUZU_USE_BUNDLED_FFMPEG AND NOT (WIN32 OR ANDROID)) +# add_dependencies(video_core ffmpeg-build) +#endif() target_include_directories(video_core PRIVATE ${FFmpeg_INCLUDE_DIR}) target_link_libraries(video_core PRIVATE ${FFmpeg_LIBRARIES}) diff --git a/src/video_core/host_shaders/CMakeLists.txt b/src/video_core/host_shaders/CMakeLists.txt -index 2149ab93e..96889f00b 100644 +index c4d459077..6354674db 100644 --- a/src/video_core/host_shaders/CMakeLists.txt +++ b/src/video_core/host_shaders/CMakeLists.txt -@@ -44,9 +44,9 @@ set(SHADER_FILES +@@ -65,9 +65,9 @@ set(SHADER_FILES ) find_program(GLSLANGVALIDATOR "glslangValidator") @@ -57,5 +57,5 @@ index 2149ab93e..96889f00b 100644 set(GLSL_FLAGS "") set(QUIET_FLAG "--quiet") -- -2.38.1 +2.41.0