From e0199480176a6c079e972862b3b88b9187686051 Mon Sep 17 00:00:00 2001 From: Bluemangoo Date: Thu, 23 Apr 2026 19:42:09 +0800 Subject: [PATCH] dockerfile, modify it when using --- .dockerignore | 20 ++++++++++++++ client.DOCKERFILE | 20 ++++++++++++++ sekai-unpacker-client.example.yaml | 5 +++- server.DOCKERFILE | 43 ++++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 client.DOCKERFILE create mode 100644 server.DOCKERFILE diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..4a13a2a --- /dev/null +++ b/.dockerignore @@ -0,0 +1,20 @@ +# Git files +.git +.gitignore + +# Build artifacts +target/ + +# Logs +logs/ +*.log + +# Data +data/ + +# IDE +.idea/ +.vscode/ +*.swp +*.swo +*~ \ No newline at end of file diff --git a/client.DOCKERFILE b/client.DOCKERFILE new file mode 100644 index 0000000..71f0cbb --- /dev/null +++ b/client.DOCKERFILE @@ -0,0 +1,20 @@ +FROM rust:slim-bookworm AS builder +WORKDIR /usr/src/app + +RUN apt-get update && apt-get install -y musl-tools pkg-config libssl-dev +RUN rustup target add x86_64-unknown-linux-musl +COPY . . + +RUN cargo build --target x86_64-unknown-linux-musl --release --bin client + +FROM alpine:latest +RUN apk add --no-cache ca-certificates +RUN update-ca-certificates +WORKDIR /app +COPY --from=builder /usr/src/app/target/x86_64-unknown-linux-musl/release/client . + +# Copy config file +COPY sekai-unpacker-client.yaml . + +CMD ["./client", "-p", "cn", "-p", "jp"] +EXPOSE 3000 diff --git a/sekai-unpacker-client.example.yaml b/sekai-unpacker-client.example.yaml index 993f698..4fbfaba 100644 --- a/sekai-unpacker-client.example.yaml +++ b/sekai-unpacker-client.example.yaml @@ -51,7 +51,7 @@ profiles: region: cn # ========== 版本信息配置(可选) ========== - # 以下三个字段如果设置,则覆盖 dynamic_load 中的值 + # 以下三个字段会被 dynamic_load 中的值覆盖 # 应用版本 # app_version: "6.0.0" @@ -72,6 +72,7 @@ profiles: app_version: appVersion asset_version: assetVersion asset_hash: assetHash + # concurrent: concurrent # [可选] 远程并发数,需为数字 # ========== 下载配置 ========== # 更新间隔(秒,可选) @@ -167,8 +168,10 @@ profiles: dynamic_load: url: "https://github.com/Team-Haruki/haruki-sekai-master/raw/refs/heads/main/versions/current_version.json" map: + # app_version: appVersion asset_version: assetVersion asset_hash: assetHash + # concurrent: concurrent # [可选] 远程并发数,需为数字 # 过滤配置 filters: diff --git a/server.DOCKERFILE b/server.DOCKERFILE new file mode 100644 index 0000000..ea4a330 --- /dev/null +++ b/server.DOCKERFILE @@ -0,0 +1,43 @@ +FROM rust:slim-bookworm AS builder +WORKDIR /usr/src/app +RUN cargo build --release +RUN apt-get update && apt-get install -y musl-tools pkg-config libssl-dev +RUN rustup target add x86_64-unknown-linux-musl +COPY . . +RUN cargo build --target x86_64-unknown-linux-musl --release --bin client + +FROM mcr.microsoft.com/dotnet/sdk:9.0-bookworm-slim AS assetstudio-builder +WORKDIR /src +RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates && \ + rm -rf /var/lib/apt/lists/* +RUN git clone --depth 1 --single-branch --branch sekai-modify https://github.com/Team-Haruki/AssetStudio.git +RUN cd AssetStudio/AssetStudioCLI && \ + dotnet publish -c Release -r linux-x64 -f net9.0 --self-contained true -o /app/assetstudio \ + -p:PublishTrimmed=false \ + -p:PublishSingleFile=true \ + -p:IncludeNativeLibrariesForSelfExtract=true + +FROM mwader/static-ffmpeg:7.1.1 AS ffmpeg-builder + +FROM debian:trixie-slim + +RUN apt-get update && apt-get install -y --no-install-recommends \ + ca-certificates \ + tzdata \ + libicu76 \ + libxml2 && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /app +COPY --from=builder /app/target/release/server /app/server +COPY --from=assetstudio-builder /app/assetstudio /app/server +COPY --from=ffmpeg-builder /ffmpeg /usr/local/bin/ffmpeg +RUN ln -sf /app/assetstudio/AssetStudioModCLI /app/assetstudio/AssetStudioCLI && \ + mkdir -p logs + +ENV TZ=Asia/Shanghai \ + DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \ + +EXPOSE 3000 + +CMD ["./server"] \ No newline at end of file