Add asset local server service

This commit is contained in:
2025-01-04 07:53:40 +08:00
parent fae080ea87
commit 7e5888e7e5
13 changed files with 146 additions and 3560 deletions

View File

@ -1,32 +0,0 @@
FROM docker.io/library/debian:latest AS builder
# First - build
RUN apt update && apt install -y curl libssl-dev perl git gcc make
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash
RUN apt update && apt install -y nodejs
RUN curl -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --default-toolchain stable --profile minimal
WORKDIR /ew/
COPY ./ ./
WORKDIR /ew/webui/
RUN npm i && npm run build
WORKDIR /ew/
RUN . "$HOME/.cargo/env" && cargo build --release
## Second - sort stuff idk
FROM docker.io/library/debian:bookworm-slim
RUN mkdir -p /root/ew/
COPY --from=builder /ew/target/release/ew /root/ew/ew
COPY ./docker/start.sh /root/ew/start.sh
RUN chmod +x /root/ew/start.sh
ENTRYPOINT ["/root/ew/start.sh"]

View File

@ -1,15 +1,16 @@
version: '3'
services:
sif2-ew:
image: sif2-ew:latest
container_name: sif2-ew
build:
dockerfile: "./Dockerfile"
lovelive_sif2:
image: lovelive_sif2:latest
container_name: lovelive_sif2
environment:
PORT: 8080
ASSET_PORT: 8000
DIRECTORY: /data/
ASSET_DIRECTORY: /assets/
HTTPS: false
NPPS4_ADDRESS: "http://127.0.0.1:51376"
ENABLE_ASSET_SERVER: false
#NPPS4_ADDRESS: "http://127.0.0.1:51376"
MAXTIME: 1717045200 # A day before global EOS
HIDDEN: false # Will disable the webui
DISABLE_IMPORTS: false # Will disable account imports
@ -22,7 +23,12 @@ services:
#IOS_JAPAN: "link.to/ios/japan.ipa"
#ASSET_URL: "link.to/client/assets/"
ports:
- 8080:8080
- "8080:8080"
- "8000:8000"
volumes:
# 只修改左侧本地路径
# 数据库存放路径(建议添加)
- ./data:/data
# 资源文件存放路径搭建asset server需要指定本地资源路径
- ./assets:/assets
restart: unless-stopped

View File

@ -1,8 +1,15 @@
#!/bin/bash
port="${PORT:-8080}"
directory="${DIRECTORY:-/data/}"
enable_asset_server=$([ "$ENABLE_ASSET_SERVER" = "true" ] && echo "--enable_asset_server" || echo "")
asset_port="${ASSET_PORT:-8000}"
assets_directory="${ASSET_DIRECTORY:-/assets/}"
npps4="${NPPS4_ADDRESS:-http://127.0.0.1:51376}"
https=$([ "$HTTPS" = "true" ] && echo "--https" || echo "")
@ -25,4 +32,25 @@ asset_android_en=$([ "$EN_ANDROID_ASSET_HASH" != "" ] && echo "--en-android-asse
asset_ios_en=$([ "$EN_IOS_ASSET_HASH" != "" ] && echo "--en-ios-asset-hash $EN_IOS_ASSET_HASH" || echo "")
/root/ew/ew --path $directory --port $port --npps4 $npps4 $asset_android_jp $asset_ios_jp $asset_android_en $asset_ios_en $exports $imports $purge $hidden $https --global-android "$ANDROID_GLOBAL" --japan-android "$ANDROID_JAPAN" --global-ios "$IOS_GLOBAL" --japan-ios "$IOS_JAPAN" --assets-url "$ASSET_URL" --max-time $maxTime
/root/ew/ew \
--path "$directory" \
--port "$port" \
"$enable_asset_server" \
--asset_path "$assets_directory" \
--asset_port "$asset_port" \
--npps4 "$npps4" \
"$asset_android_jp" \
"$asset_ios_jp" \
"$asset_android_en" \
"$asset_ios_en" \
"$exports" \
"$imports" \
"$purge" \
"$hidden" \
"$https" \
--global-android "$ANDROID_GLOBAL" \
--japan-android "$ANDROID_JAPAN" \
--global-ios "$IOS_GLOBAL" \
--japan-ios "$IOS_JAPAN" \
--assets-url "$ASSET_URL" \
--max-time "$maxTime"