|
| 1 | +# syntax=docker/dockerfile:1 |
| 2 | +FROM ubuntu:24.04 |
| 3 | +ARG STUDIO_VERSION |
| 4 | +ARG DEBIAN_FRONTEND=noninteractive |
| 5 | + |
| 6 | +# --- System deps (cached layer, rarely changes) --- |
| 7 | +# Mirrors linux-prerequisites.ts:installDependenciesAsync() |
| 8 | +RUN dpkg --add-architecture i386 \ |
| 9 | + && apt-get update \ |
| 10 | + && apt-get install -y --no-install-recommends \ |
| 11 | + ca-certificates curl gnupg software-properties-common \ |
| 12 | + xvfb openbox mesa-utils \ |
| 13 | + gcc-mingw-w64-x86-64 unzip procps \ |
| 14 | + # WineHQ repo for Wine 11+ (same logic as linux-prerequisites.ts:91-128) |
| 15 | + && mkdir -pm755 /etc/apt/keyrings \ |
| 16 | + && curl -sL https://dl.winehq.org/wine-builds/winehq.key \ |
| 17 | + -o /etc/apt/keyrings/winehq-archive.key \ |
| 18 | + && curl -sfL https://dl.winehq.org/wine-builds/ubuntu/dists/noble/winehq-noble.sources \ |
| 19 | + -o /etc/apt/sources.list.d/winehq-noble.sources \ |
| 20 | + && apt-get update \ |
| 21 | + && apt-get install -y --no-install-recommends winehq-stable \ |
| 22 | + && apt-get clean && rm -rf /var/lib/apt/lists/* |
| 23 | + |
| 24 | +# --- Node.js 22 LTS --- |
| 25 | +RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \ |
| 26 | + && apt-get install -y --no-install-recommends nodejs \ |
| 27 | + && corepack enable pnpm \ |
| 28 | + && apt-get clean && rm -rf /var/lib/apt/lists/* |
| 29 | + |
| 30 | +# --- Non-root user --- |
| 31 | +RUN useradd -m -s /bin/bash studio |
| 32 | +USER studio |
| 33 | +WORKDIR /home/studio |
| 34 | + |
| 35 | +# --- Build studio-bridge from source (via named build context "workspace") --- |
| 36 | +COPY --from=workspace --chown=studio:studio package.json pnpm-workspace.yaml pnpm-lock.yaml tsconfig.json /home/studio/build/ |
| 37 | +COPY --from=workspace --chown=studio:studio tools/ /home/studio/build/tools/ |
| 38 | +WORKDIR /home/studio/build |
| 39 | +RUN pnpm install --frozen-lockfile --filter "@quenty/studio-bridge..." \ |
| 40 | + && pnpm -r --filter "@quenty/studio-bridge..." run build |
| 41 | + |
| 42 | +# --- Run studio-bridge to set up Studio (single source of truth!) --- |
| 43 | +# Invoke cli.js directly — workspace deps are resolved by pnpm in node_modules. |
| 44 | +RUN node tools/studio-bridge/dist/src/cli/cli.js linux setup \ |
| 45 | + ${STUDIO_VERSION:+--studio-version "$STUDIO_VERSION"} |
| 46 | + |
| 47 | +# --- Install studio-bridge globally for runtime, then clean up --- |
| 48 | +# Use pnpm deploy to create a self-contained copy with resolved workspace deps, |
| 49 | +# then link the binary. This avoids npm registry lookups for workspace packages. |
| 50 | +RUN pnpm --filter "@quenty/studio-bridge" deploy --legacy --prod /home/studio/.studio-bridge \ |
| 51 | + && mkdir -p /home/studio/.npm-global/bin \ |
| 52 | + && ln -s /home/studio/.studio-bridge/dist/src/cli/cli.js /home/studio/.npm-global/bin/studio-bridge \ |
| 53 | + && chmod +x /home/studio/.studio-bridge/dist/src/cli/cli.js \ |
| 54 | + && rm -rf /home/studio/build |
| 55 | + |
| 56 | +# --- Environment (matches linux-wine-env.ts:buildWineEnv) --- |
| 57 | +ENV STUDIO_DIR=/home/studio/roblox-studio \ |
| 58 | + WINEPREFIX=/home/studio/.wine \ |
| 59 | + DISPLAY=:99 \ |
| 60 | + WINEDEBUG=-all \ |
| 61 | + WINEARCH=win64 \ |
| 62 | + WINEDLLOVERRIDES="mscoree=d;mshtml=d" \ |
| 63 | + MESA_GL_VERSION_OVERRIDE=4.5 \ |
| 64 | + MESA_GLSL_VERSION_OVERRIDE=450 \ |
| 65 | + NPM_CONFIG_PREFIX=/home/studio/.npm-global \ |
| 66 | + PATH=/home/studio/.npm-global/bin:$PATH |
| 67 | + |
| 68 | +COPY --chown=studio:studio entrypoint.sh /home/studio/entrypoint.sh |
| 69 | +RUN chmod +x /home/studio/entrypoint.sh |
| 70 | +WORKDIR /home/studio |
| 71 | +ENTRYPOINT ["/home/studio/entrypoint.sh"] |
| 72 | +CMD ["bash"] |
0 commit comments