mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-02-03 12:31:15 +00:00
Replace NGINX with Vite dev server in Docker setup (#777)
Some checks failed
CI / clang-format (push) Has been cancelled
CI / ${{ matrix.name }} (false, --toolchain /usr/local/vitasdk/share/vita.toolchain.cmake, false, false, Ninja, Vita, ubuntu-latest, true, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0.26100.0, false, false, Visual Studio 17 2022, true, Xbox One, windows-latest, amd64, false, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/3DS.cmake, false, devkitpro/devkitarm:latest, false, Ninja, true, Nintendo 3DS, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake, false, devkitpro/devkita64:latest, false, Ninja, Nintendo Switch, true, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, emcmake, false, false, true, Ninja, Emscripten, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, false, false, Ninja, true, MSVC (arm64), windows-latest, amd64_arm64, false) (push) Has been cancelled
CI / ${{ matrix.name }} (false, false, true, Ninja, true, MSVC (x86), windows-latest, amd64_x86, false) (push) Has been cancelled
CI / ${{ matrix.name }} (false, true, false, Ninja, true, MSVC (x64), windows-latest, amd64, false) (push) Has been cancelled
CI / ${{ matrix.name }} (false, true, true, false, Ninja, true, MSVC (x64 Debug), windows-latest, amd64, false) (push) Has been cancelled
CI / ${{ matrix.name }} (true, false, -DCMAKE_SYSTEM_NAME=iOS, false, false, Xcode, true, iOS, macos-15, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, false, false, Ninja, true, mingw-w64-i686, mingw32, msys2 mingw32, windows-latest, msys2 {0}, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, false, false, false, Ninja, Android, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, false, true, false, Ninja, macOS, macos-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, true, false, Ninja, true, mingw-w64-x86_64, mingw64, msys2 mingw64, windows-latest, msys2 {0}, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, true, true, false, Ninja, true, Linux (Debug), ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, true, true, false, Ninja, true, Linux, ubuntu-latest, true) (push) Has been cancelled
CI / Flatpak (${{ matrix.arch }}) (aarch64, ubuntu-22.04-arm) (push) Has been cancelled
CI / Flatpak (${{ matrix.arch }}) (x86_64, ubuntu-latest) (push) Has been cancelled
CI / C++ (push) Has been cancelled
Docker / Publish web port (push) Has been cancelled
CI / Release (push) Has been cancelled
Some checks failed
CI / clang-format (push) Has been cancelled
CI / ${{ matrix.name }} (false, --toolchain /usr/local/vitasdk/share/vita.toolchain.cmake, false, false, Ninja, Vita, ubuntu-latest, true, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0.26100.0, false, false, Visual Studio 17 2022, true, Xbox One, windows-latest, amd64, false, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/3DS.cmake, false, devkitpro/devkitarm:latest, false, Ninja, true, Nintendo 3DS, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake, false, devkitpro/devkita64:latest, false, Ninja, Nintendo Switch, true, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, emcmake, false, false, true, Ninja, Emscripten, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, false, false, Ninja, true, MSVC (arm64), windows-latest, amd64_arm64, false) (push) Has been cancelled
CI / ${{ matrix.name }} (false, false, true, Ninja, true, MSVC (x86), windows-latest, amd64_x86, false) (push) Has been cancelled
CI / ${{ matrix.name }} (false, true, false, Ninja, true, MSVC (x64), windows-latest, amd64, false) (push) Has been cancelled
CI / ${{ matrix.name }} (false, true, true, false, Ninja, true, MSVC (x64 Debug), windows-latest, amd64, false) (push) Has been cancelled
CI / ${{ matrix.name }} (true, false, -DCMAKE_SYSTEM_NAME=iOS, false, false, Xcode, true, iOS, macos-15, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, false, false, Ninja, true, mingw-w64-i686, mingw32, msys2 mingw32, windows-latest, msys2 {0}, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, false, false, false, Ninja, Android, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, false, true, false, Ninja, macOS, macos-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, true, false, Ninja, true, mingw-w64-x86_64, mingw64, msys2 mingw64, windows-latest, msys2 {0}, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, true, true, false, Ninja, true, Linux (Debug), ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, true, true, false, Ninja, true, Linux, ubuntu-latest, true) (push) Has been cancelled
CI / Flatpak (${{ matrix.arch }}) (aarch64, ubuntu-22.04-arm) (push) Has been cancelled
CI / Flatpak (${{ matrix.arch }}) (x86_64, ubuntu-latest) (push) Has been cancelled
CI / C++ (push) Has been cancelled
Docker / Publish web port (push) Has been cancelled
CI / Release (push) Has been cancelled
- Use Node.js runtime instead of OpenResty/NGINX - Clone isle.pizza frontend from master branch - Add entrypoint script that runs prepare:assets and starts Vite - Remove ISLE_EMSCRIPTEN_HOST build flag - Delete nginx.conf (no longer needed)
This commit is contained in:
parent
4048e741bb
commit
03cb40190a
@ -31,15 +31,24 @@ COPY --chown=emscripten:emscripten packaging/ ./packaging/
|
||||
COPY --chown=emscripten:emscripten extensions/ ./extensions/
|
||||
COPY --chown=emscripten:emscripten CMakeLists.txt .
|
||||
|
||||
RUN emcmake cmake -S . -B build -DISLE_BUILD_CONFIG=OFF -DISLE_DEBUG=OFF -DCMAKE_BUILD_TYPE=Release -DISLE_EMSCRIPTEN_HOST=/assets && \
|
||||
RUN emcmake cmake -S . -B build -DISLE_BUILD_CONFIG=OFF -DISLE_DEBUG=OFF -DCMAKE_BUILD_TYPE=Release && \
|
||||
emmake cmake --build build -j 32
|
||||
|
||||
RUN echo "Fetching isle.pizza frontend..."; \
|
||||
git clone --depth 1 -b legacy https://github.com/isledecomp/isle.pizza /tmp/isle.pizza;
|
||||
git clone --depth 1 https://github.com/isledecomp/isle.pizza /tmp/isle.pizza;
|
||||
|
||||
FROM openresty/openresty:alpine
|
||||
FROM node:22-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /tmp/isle.pizza ./
|
||||
COPY --from=builder /src/build/isle.js /src/build/isle.wasm ./
|
||||
|
||||
RUN npm ci
|
||||
|
||||
COPY docker/emscripten/entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
COPY docker/emscripten/nginx.conf /usr/local/openresty/nginx/conf/nginx.conf
|
||||
COPY --from=builder /tmp/isle.pizza /usr/local/openresty/nginx/html
|
||||
COPY --from=builder /src/build/isle.* /usr/local/openresty/nginx/html
|
||||
EXPOSE 6931
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
8
docker/emscripten/entrypoint.sh
Normal file
8
docker/emscripten/entrypoint.sh
Normal file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
echo "Setting up LEGO Island assets..."
|
||||
npm run prepare:assets -- -f -p /assets
|
||||
|
||||
echo "Starting development server..."
|
||||
exec npm run dev -- --host 0.0.0.0 --port 6931
|
||||
@ -1,82 +0,0 @@
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
init_by_lua_block {
|
||||
function find_entry_in_dir(parent_dir, name_to_find)
|
||||
local safe_parent_dir = string.gsub(parent_dir, "'", "'\\''")
|
||||
local lower_name_to_find = string.lower(name_to_find)
|
||||
local pipe = io.popen("ls -A '" .. safe_parent_dir .. "' 2>/dev/null")
|
||||
if not pipe then return nil end
|
||||
|
||||
for entry in pipe:lines() do
|
||||
if string.lower(entry) == lower_name_to_find then
|
||||
pipe:close()
|
||||
return entry
|
||||
end
|
||||
end
|
||||
pipe:close()
|
||||
return nil
|
||||
end
|
||||
|
||||
function find_recursive_path(path_to_check)
|
||||
local current_resolved_path = "/"
|
||||
|
||||
for component in string.gmatch(path_to_check, "([^/]+)") do
|
||||
local found_entry = find_entry_in_dir(current_resolved_path, component)
|
||||
if not found_entry then
|
||||
return nil
|
||||
end
|
||||
|
||||
if current_resolved_path == "/" then
|
||||
current_resolved_path = current_resolved_path .. found_entry
|
||||
else
|
||||
current_resolved_path = current_resolved_path .. "/" .. found_entry
|
||||
end
|
||||
end
|
||||
return current_resolved_path
|
||||
end
|
||||
}
|
||||
|
||||
include /usr/local/openresty/nginx/conf/mime.types;
|
||||
|
||||
server {
|
||||
listen 6931;
|
||||
server_name localhost;
|
||||
|
||||
add_header 'Cross-Origin-Embedder-Policy' 'require-corp';
|
||||
add_header 'Cross-Origin-Opener-Policy' 'same-origin';
|
||||
add_header 'Cross-Origin-Resource-Policy' 'cross-origin';
|
||||
|
||||
location / {
|
||||
root /usr/local/openresty/nginx/html;
|
||||
index index.html isle.html;
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
location /assets/ {
|
||||
content_by_lua_block {
|
||||
local request_uri = ngx.var.uri
|
||||
local resolved_path = find_recursive_path(request_uri)
|
||||
|
||||
if not resolved_path then
|
||||
local fallback_uri = ngx.re.sub(request_uri, [[^/assets/]], "/assets/DATA/disk/", "i")
|
||||
resolved_path = find_recursive_path(fallback_uri)
|
||||
end
|
||||
|
||||
if resolved_path then
|
||||
ngx.exec("/internal" .. resolved_path)
|
||||
else
|
||||
ngx.exit(ngx.HTTP_NOT_FOUND)
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
location /internal/assets/ {
|
||||
internal;
|
||||
root /;
|
||||
rewrite ^/internal(.*)$ $1 break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user