Update Dockerfile
This commit is contained in:
112
Dockerfile
112
Dockerfile
@@ -1,46 +1,66 @@
|
||||
ARG CUDA_VER=12.8.0
|
||||
ARG UBUNTU_VER=24.04
|
||||
ARG GO_VERSION=1.24.1
|
||||
|
||||
FROM nvidia/cuda:${CUDA_VER}-devel-ubuntu${UBUNTU_VER} AS builder
|
||||
FROM nvidia/cuda:${CUDA_VER}-devel-ubuntu${UBUNTU_VER} AS danser-builder
|
||||
ARG GO_VERSION
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
build-essential autoconf pkg-config git git-lfs curl wget jq ca-certificates \
|
||||
libpng-dev libfreetype6-dev libfontconfig1-dev libxml2-dev ghostscript webp \
|
||||
libgtk-3-dev libglib2.0-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ARG GO_VERSION=1.24.1
|
||||
RUN curl -fsSL "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" -o /tmp/go.tgz \
|
||||
&& rm -rf /usr/local/go \
|
||||
&& tar -C /usr/local -xzf /tmp/go.tgz \
|
||||
&& rm /tmp/go.tgz
|
||||
ENV PATH=/usr/local/go/bin:$PATH
|
||||
|
||||
# Clone danser-go and build danser-cli inside the repo directory
|
||||
RUN git clone --depth 1 --branch fix-screenshot-slider-ticks \
|
||||
https://github.com/Arlind-dev/danser-go.git /src/danser \
|
||||
&& cd /src/danser \
|
||||
&& go build -ldflags="-s -w" -o danser-cli . \
|
||||
&& strip danser-cli || true
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
build-essential git git-lfs ca-certificates curl xz-utils xorg-dev libgl1-mesa-dev libgtk-3-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Fetch ffmpeg prebuilt binaries
|
||||
RUN set -eux; \
|
||||
mkdir -p /out/ffmpeg; \
|
||||
URL="$(curl -s https://api.github.com/repos/BtbN/FFmpeg-Builds/releases/latest \
|
||||
| jq -r '.assets[].browser_download_url' \
|
||||
| grep -E 'linux64-gpl(\-shared)?\.tar\.xz$' \
|
||||
| head -n 1)"; \
|
||||
wget -qO /tmp/ffmpeg.tar.xz "$URL"; \
|
||||
tar -xf /tmp/ffmpeg.tar.xz -C /tmp; \
|
||||
FF_DIR="$(find /tmp -maxdepth 1 -type d -name 'ffmpeg-*' | head -n 1)"; \
|
||||
cp "$FF_DIR/bin/ffmpeg" /out/ffmpeg/; \
|
||||
cp "$FF_DIR/bin/ffprobe" /out/ffmpeg/ || true; \
|
||||
cp "$FF_DIR/bin/ffplay" /out/ffmpeg/ || true; \
|
||||
if [ -d "$FF_DIR/lib" ]; then mkdir -p /out/ffmpeg/lib && cp -a "$FF_DIR/lib/." /out/ffmpeg/lib/; fi; \
|
||||
rm -rf /tmp/ffmpeg* /tmp/ffmpeg.tar.xz
|
||||
url="https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz"; \
|
||||
for i in 1 2 3; do \
|
||||
curl -fsSL -o /tmp/go.tgz "$url" && break || sleep 3; \
|
||||
done; \
|
||||
rm -rf /usr/local/go; \
|
||||
tar -C /usr/local -xzf /tmp/go.tgz; \
|
||||
rm /tmp/go.tgz
|
||||
|
||||
RUN git clone --depth 1 --branch dev https://github.com/Wieku/danser-go.git /src/danser
|
||||
WORKDIR /src/danser
|
||||
|
||||
RUN set -eux; \
|
||||
git lfs install --system; \
|
||||
git lfs pull; \
|
||||
export GOOS=linux; \
|
||||
export GOARCH=amd64; \
|
||||
export CGO_ENABLED=1; \
|
||||
export CC=gcc; \
|
||||
export CXX=g++; \
|
||||
BUILD_DIR=/tmp/danser-build-linux; \
|
||||
mkdir -p "$BUILD_DIR"; \
|
||||
go run tools/assets/assets.go ./ "$BUILD_DIR/"; \
|
||||
go build -trimpath -ldflags "-s -w -X 'github.com/wieku/danser-go/build.VERSION=dev' -X 'github.com/wieku/danser-go/build.Stream=Release'" \
|
||||
-buildmode=c-shared -o "$BUILD_DIR/danser-core.so" \
|
||||
-tags "exclude_cimgui_glfw exclude_cimgui_sdli"; \
|
||||
mv "$BUILD_DIR/danser-core.so" "$BUILD_DIR/libdanser-core.so"; \
|
||||
cp libbass.so libbass_fx.so libbassmix.so libyuv.so libSDL3.so "$BUILD_DIR/"; \
|
||||
gcc -no-pie -O3 -o "$BUILD_DIR/danser-cli" -I. cmain/main_danser.c -I"$BUILD_DIR/" -Wl,-rpath,'$ORIGIN' -L"$BUILD_DIR/" -ldanser-core; \
|
||||
gcc -no-pie -O3 -D LAUNCHER -o "$BUILD_DIR/danser" -I. cmain/main_danser.c -I"$BUILD_DIR/" -Wl,-rpath,'$ORIGIN' -L"$BUILD_DIR/" -ldanser-core; \
|
||||
strip "$BUILD_DIR/danser" "$BUILD_DIR/danser-cli" 2>/dev/null || true; \
|
||||
rm -f "$BUILD_DIR/danser-core.h"; \
|
||||
mkdir -p "$BUILD_DIR/ffmpeg/bin"; \
|
||||
curl -fsSL -o /tmp/ffmpeg.tar.xz "https://github.com/BtbN/FFmpeg-Builds/releases/latest/download/ffmpeg-master-latest-linux64-gpl.tar.xz" \
|
||||
|| curl -fsSL -o /tmp/ffmpeg.tar.xz "https://github.com/BtbN/FFmpeg-Builds/releases/latest/download/ffmpeg-master-latest-linux64-gpl-shared.tar.xz"; \
|
||||
tar -xf /tmp/ffmpeg.tar.xz -C /tmp; \
|
||||
FF_DIR="$(find /tmp -maxdepth 1 -type d -name 'ffmpeg-*' | head -n 1)"; \
|
||||
cp "$FF_DIR/bin/ffmpeg" "$BUILD_DIR/ffmpeg/bin/"; \
|
||||
cp "$FF_DIR/bin/ffprobe" "$BUILD_DIR/ffmpeg/bin/" || true; \
|
||||
cp "$FF_DIR/bin/ffplay" "$BUILD_DIR/ffmpeg/bin/" || true; \
|
||||
if [ -d "$FF_DIR/lib" ]; then mkdir -p "$BUILD_DIR/ffmpeg/lib" && cp -a "$FF_DIR/lib/." "$BUILD_DIR/ffmpeg/lib/"; fi; \
|
||||
rm -rf /tmp/ffmpeg* /tmp/ffmpeg.tar.xz; \
|
||||
chmod 755 "$BUILD_DIR/danser" "$BUILD_DIR/danser-cli" "$BUILD_DIR/ffmpeg/bin/ffmpeg" || true; \
|
||||
chmod 755 "$BUILD_DIR/ffmpeg/bin/ffprobe" "$BUILD_DIR/ffmpeg/bin/ffplay" 2>/dev/null || true; \
|
||||
mkdir -p /out/danser; \
|
||||
cp -a "$BUILD_DIR/." /out/danser/; \
|
||||
mkdir -p /out/danser/settings /out/danser/Songs /out/danser/Skins /out/danser/Replays /out/danser/videos; \
|
||||
rm -rf "$BUILD_DIR"
|
||||
|
||||
# Build and stage ImageMagick into /tmp/im/usr/local
|
||||
RUN set -eux; \
|
||||
IMAGICK_URL="$(curl -s https://api.github.com/repos/ImageMagick/ImageMagick/releases/latest | jq -r '.tarball_url')"; \
|
||||
mkdir -p /tmp/im; \
|
||||
@@ -64,25 +84,21 @@ RUN set -eux; \
|
||||
FROM nvidia/cuda:${CUDA_VER}-runtime-ubuntu${UBUNTU_VER} AS runtime
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
git curl ca-certificates \
|
||||
xz-utils \
|
||||
libglvnd0 libgl1 libegl1 libgles2 \
|
||||
libx11-6 libxext6 \
|
||||
xvfb \
|
||||
libgtk-3-0 libglib2.0-0 \
|
||||
libpng16-16 libfreetype6 libfontconfig1 libxml2 ghostscript webp \
|
||||
fonts-urw-base35 fonts-noto-color-emoji fonts-dejavu-core \
|
||||
jq git-lfs \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& fc-cache -f -v
|
||||
|
||||
ARG NODE_VERSION=20.11.1
|
||||
RUN curl -fsSL "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz" -o /tmp/node.tar.xz \
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
libglvnd0 libegl1 libgles2 libgl1 libgtk-3-0 libglib2.0-0 \
|
||||
git curl jq git-lfs \
|
||||
xz-utils libpng16-16 libfreetype6 libfontconfig1 libxml2 ghostscript webp \
|
||||
fonts-urw-base35 fonts-noto-color-emoji fonts-dejavu-core \
|
||||
&& curl -fsSL "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz" -o /tmp/node.tar.xz \
|
||||
&& tar -C /usr/local --strip-components=1 -xf /tmp/node.tar.xz \
|
||||
&& rm /tmp/node.tar.xz \
|
||||
&& node --version \
|
||||
&& npm --version
|
||||
&& npm --version \
|
||||
&& fc-cache -f -v \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN install -d -m 755 /etc/glvnd/egl_vendor.d \
|
||||
&& cat >/etc/glvnd/egl_vendor.d/10_nvidia.json <<'EOF'
|
||||
|
||||
Reference in New Issue
Block a user