This commit is contained in:
+112
@@ -0,0 +1,112 @@
|
||||
# syntax=docker/dockerfile:1.7
|
||||
FROM alpine:3.23@sha256:fd791d74b68913cbb027c6546007b3f0d3bc45125f797758156952bc2d6daf40 AS emulator
|
||||
ARG EMULATORJS_VERSION=4.2.3
|
||||
ARG EMULATORJS_SHA256=07d451bc06fa3ad04ab30d9b94eb63ac34ad0babee52d60357b002bde8f3850b
|
||||
COPY .build-inputs/emulatorjs/ /tmp/emulatorjs-input/
|
||||
RUN fetch() { \
|
||||
url="$1"; destination="$2"; attempt=1; \
|
||||
while :; do \
|
||||
if wget -q -T 60 "$url" -O "${destination}.part"; then mv "${destination}.part" "$destination"; return 0; fi; \
|
||||
rm -f "${destination}.part"; \
|
||||
[ "$attempt" -lt 5 ] || return 1; \
|
||||
sleep "$attempt"; attempt=$((attempt + 1)); \
|
||||
done; \
|
||||
} \
|
||||
&& apk add --no-cache p7zip \
|
||||
&& if [ -f "/tmp/emulatorjs-input/${EMULATORJS_VERSION}.7z" ]; then cp "/tmp/emulatorjs-input/${EMULATORJS_VERSION}.7z" /tmp/emulatorjs.7z; else fetch "https://github.com/EmulatorJS/EmulatorJS/releases/download/v${EMULATORJS_VERSION}/${EMULATORJS_VERSION}.7z" /tmp/emulatorjs.7z; fi \
|
||||
&& echo "${EMULATORJS_SHA256} /tmp/emulatorjs.7z" | sha256sum -c - \
|
||||
&& 7z x -y /tmp/emulatorjs.7z -o/emulatorjs >/dev/null \
|
||||
&& find /emulatorjs/data/cores -type f ! -path '/emulatorjs/data/cores/reports/*' ! -name 'fceumm-*' ! -name 'snes9x-*' ! -name 'gambatte-*' ! -name 'mgba-*' ! -name 'melonds-*' ! -name 'genesis_plus_gx-*' ! -name 'pcsx_rearmed-*' ! -name 'mednafen_psx_hw-*' ! -name 'ppsspp-*' ! -name 'cores.json' ! -name 'core-README.md' -delete \
|
||||
&& sed -i 's#https://cdn.emulatorjs.org/stable/data/version.json#/emulatorjs/data/version.json#g' /emulatorjs/data/emulator.min.js /emulatorjs/data/src/emulator.js \
|
||||
&& ! grep -R -F 'https://cdn.emulatorjs.org/stable/data/version.json' /emulatorjs/data \
|
||||
&& printf '%s\n' 'EmulatorJS 4.2.3 update metadata is resolved from the bundled same-origin version.json; no runtime CDN request is allowed.' > /emulatorjs/LUDARIUM_PATCHES.txt \
|
||||
&& rm /tmp/emulatorjs.7z
|
||||
|
||||
FROM alpine:3.23@sha256:fd791d74b68913cbb027c6546007b3f0d3bc45125f797758156952bc2d6daf40 AS playjs
|
||||
ARG PLAYJS_UPSTREAM_COMMIT=04bde0df87ee7c0e2f0151b51bb2cc22c88541da
|
||||
ARG PLAYJS_JS_SHA256=5599ff16ae5e3534f9b779736aedfa20661821d57be7f03e587e31ef8d090317
|
||||
ARG PLAYJS_WASM_SHA256=de3ae0efdd7938d1b5ac754a096ec180094d64702ae84b962c4bb9f79abb1da7
|
||||
ARG PLAYJS_LICENSE_SHA256=e9089da5950600267bb657503aba6eb59cb679b455c2997d341d83144144daab
|
||||
RUN fetch() { \
|
||||
url="$1"; destination="$2"; attempt=1; \
|
||||
while :; do \
|
||||
if wget -q -T 60 "$url" -O "${destination}.part"; then mv "${destination}.part" "$destination"; return 0; fi; \
|
||||
rm -f "${destination}.part"; \
|
||||
[ "$attempt" -lt 5 ] || return 1; \
|
||||
sleep "$attempt"; attempt=$((attempt + 1)); \
|
||||
done; \
|
||||
} \
|
||||
&& mkdir -p /playjs \
|
||||
&& fetch https://playjs.purei.org/Play.js /playjs/Play.js \
|
||||
&& fetch https://playjs.purei.org/Play.wasm /playjs/Play.wasm \
|
||||
&& fetch "https://raw.githubusercontent.com/jpd002/Play-/${PLAYJS_UPSTREAM_COMMIT}/License.txt" /playjs/LICENSE.txt \
|
||||
&& echo "${PLAYJS_JS_SHA256} /playjs/Play.js" | sha256sum -c - \
|
||||
&& echo "${PLAYJS_WASM_SHA256} /playjs/Play.wasm" | sha256sum -c - \
|
||||
&& echo "${PLAYJS_LICENSE_SHA256} /playjs/LICENSE.txt" | sha256sum -c - \
|
||||
&& printf '%s\n' \
|
||||
"source=https://github.com/jpd002/Play-" \
|
||||
"commit=${PLAYJS_UPSTREAM_COMMIT}" \
|
||||
"Play.js.sha256=${PLAYJS_JS_SHA256}" \
|
||||
"Play.wasm.sha256=${PLAYJS_WASM_SHA256}" \
|
||||
"License.txt.sha256=${PLAYJS_LICENSE_SHA256}" > /playjs/PROVENANCE.txt
|
||||
|
||||
FROM alpine:3.23@sha256:fd791d74b68913cbb027c6546007b3f0d3bc45125f797758156952bc2d6daf40 AS n64wasm
|
||||
ARG N64WASM_COMMIT=bfac222f8a27287022844b47000328531834e9c1
|
||||
ARG N64WASM_JS_SHA256=1db1dce5e356d1a1673d5dab6f73afd30bf4b69523c3292b1d44e33ff8f4d22e
|
||||
ARG N64WASM_WASM_SHA256=c829ac2ac2a620816a3906af1135c1203f606b92ae7a6e118ea8a90749f028ea
|
||||
ARG N64WASM_ASSETS_SHA256=72f8b414469d0b40630c82ca193b6f67dba906bd84ccc43991ee1ac3e4b900a2
|
||||
ARG N64WASM_LICENSE_SHA256=46f8e130794f92e25e5865be3a363c3fb30210a428303c27262690cfc375c3d4
|
||||
RUN fetch() { \
|
||||
url="$1"; destination="$2"; attempt=1; \
|
||||
while :; do \
|
||||
if wget -q -T 60 "$url" -O "${destination}.part"; then mv "${destination}.part" "$destination"; return 0; fi; \
|
||||
rm -f "${destination}.part"; \
|
||||
[ "$attempt" -lt 5 ] || return 1; \
|
||||
sleep "$attempt"; attempt=$((attempt + 1)); \
|
||||
done; \
|
||||
} \
|
||||
&& mkdir -p /n64wasm \
|
||||
&& fetch "https://raw.githubusercontent.com/nbarkhina/N64Wasm/${N64WASM_COMMIT}/dist/n64wasm.js" /n64wasm/n64wasm.js \
|
||||
&& fetch "https://raw.githubusercontent.com/nbarkhina/N64Wasm/${N64WASM_COMMIT}/dist/n64wasm.wasm" /n64wasm/n64wasm.wasm \
|
||||
&& fetch "https://raw.githubusercontent.com/nbarkhina/N64Wasm/${N64WASM_COMMIT}/dist/assets.zip" /n64wasm/assets.zip \
|
||||
&& fetch "https://raw.githubusercontent.com/nbarkhina/N64Wasm/${N64WASM_COMMIT}/LICENSE" /n64wasm/LICENSE \
|
||||
&& echo "${N64WASM_JS_SHA256} /n64wasm/n64wasm.js" | sha256sum -c - \
|
||||
&& echo "${N64WASM_WASM_SHA256} /n64wasm/n64wasm.wasm" | sha256sum -c - \
|
||||
&& echo "${N64WASM_ASSETS_SHA256} /n64wasm/assets.zip" | sha256sum -c - \
|
||||
&& echo "${N64WASM_LICENSE_SHA256} /n64wasm/LICENSE" | sha256sum -c -
|
||||
|
||||
FROM node:24.4.1-alpine@sha256:820e86612c21d0636580206d802a726f2595366e1b867e564cbc652024151e8a AS web
|
||||
WORKDIR /src
|
||||
COPY src/Ludarium.Web/package.json src/Ludarium.Web/package-lock.json ./
|
||||
RUN npm ci --ignore-scripts
|
||||
COPY src/Ludarium.Web/ ./
|
||||
RUN npm run build
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/sdk:10.0.302@sha256:72dd743782f2ae7e5476fd64f6a460045e3998dc862218b80e6944cba79a01b0 AS build
|
||||
WORKDIR /src
|
||||
COPY NuGet.config global.json Directory.Build.props VERSION Ludarium.slnx ./
|
||||
COPY src/ ./src/
|
||||
RUN dotnet restore src/Ludarium.Api/Ludarium.Api.csproj --locked-mode \
|
||||
&& dotnet restore src/Ludarium.HealthCheck/Ludarium.HealthCheck.csproj --locked-mode
|
||||
COPY --from=web /artifacts/web/ ./src/Ludarium.Api/wwwroot/
|
||||
COPY --from=emulator /emulatorjs/ ./src/Ludarium.Api/wwwroot/emulatorjs/
|
||||
COPY --from=playjs /playjs/ ./src/Ludarium.Api/wwwroot/playjs/
|
||||
COPY --from=n64wasm /n64wasm/ ./src/Ludarium.Api/wwwroot/n64wasm/
|
||||
RUN dotnet publish src/Ludarium.Api/Ludarium.Api.csproj -c Release --no-restore -o /app/publish /p:UseAppHost=false \
|
||||
&& dotnet publish src/Ludarium.HealthCheck/Ludarium.HealthCheck.csproj -c Release --no-restore -o /app/health /p:UseAppHost=false
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:10.0.11-azurelinux3.0-distroless@sha256:c2fbd15651452871430ce3fbd0083c128b376dbac786797be1c7dd4091d20a23 AS final
|
||||
ARG LUDARIUM_SOURCE_REVISION=local
|
||||
ARG LUDARIUM_RELEASE_VERSION=unversioned
|
||||
LABEL org.opencontainers.image.revision="${LUDARIUM_SOURCE_REVISION}"
|
||||
LABEL org.opencontainers.image.version="${LUDARIUM_RELEASE_VERSION}"
|
||||
WORKDIR /app
|
||||
ENV ASPNETCORE_URLS=http://0.0.0.0:8734 \
|
||||
DOTNET_EnableDiagnostics=0 \
|
||||
LUDARIUM_EXPORTS=/app/exports
|
||||
COPY --from=build --chown=$APP_UID:0 /app/publish ./
|
||||
COPY --from=build --chown=$APP_UID:0 /app/health ./health/
|
||||
USER $APP_UID
|
||||
EXPOSE 8734
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 CMD ["dotnet", "/app/health/Ludarium.HealthCheck.dll"]
|
||||
ENTRYPOINT ["dotnet", "Ludarium.Api.dll"]
|
||||
Reference in New Issue
Block a user