Sega-Channel/Dockerfile
orca 065647af6d Server version, lineups and pixel-art screens; deployed on the OptiPlex
Commits the in-progress work that was sitting in the tree: the Node server
(server/), Dockerfile, lineups page, new pixel-art components and themes,
with the old library/ROM loaders and render.yaml removed. The README now
points at cyberdeck/optiplex/segachannel/deploy.py (the home server moved
from the Mac mini to an OptiPlex).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 20:02:16 -05:00

38 lines
1.6 KiB
Docker

# Sega Channel: the menu (Vite build), the Node server and EmulatorJS in one small image.
# docker build -t sega-channel .
# docker run -p 8080:8080 -v /path/to/genesis:/roms:ro -v sega-channel-data:/data sega-channel
# EmulatorJS, the same release RomM bundles, trimmed to the genesis_plus_gx core (~300 MB -> ~10 MB).
FROM alpine:3.20 AS emulatorjs
ARG EJS_VERSION=4.2.3
RUN apk add --no-cache 7zip curl \
&& curl -fsSL -o /tmp/ejs.7z "https://github.com/EmulatorJS/EmulatorJS/releases/download/v${EJS_VERSION}/${EJS_VERSION}.7z" \
&& 7z x -o/tmp/ejs /tmp/ejs.7z 'data/*' -r >/dev/null \
&& mkdir -p /ejs/cores/reports \
&& cd /tmp/ejs/data \
&& cp -r loader.js emulator.min.js emulator.min.css version.json src compression localization /ejs/ \
&& cp cores/genesis_plus_gx-*.data /ejs/cores/ \
&& cp cores/reports/genesis_plus_gx.json /ejs/cores/reports/ \
&& rm -rf /tmp/ejs /tmp/ejs.7z
FROM node:22-alpine AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --no-audit --no-fund
COPY . .
RUN npm run build
FROM node:22-alpine
ENV NODE_ENV=production PORT=8080 ROM_DIR=/roms DATA_DIR=/data EJS_DIR=/app/emulatorjs
WORKDIR /app
COPY --from=emulatorjs /ejs ./emulatorjs
COPY --from=build /app/dist ./dist
COPY server ./server
COPY data/sega-channel-lineup.json ./data/
# /data is a volume; creating it here owned by node makes a fresh named volume writable by node too.
RUN mkdir -p /data && chown node:node /data
USER node
EXPOSE 8080
VOLUME /data
HEALTHCHECK --interval=30s --timeout=3s CMD wget -qO- http://127.0.0.1:8080/healthz || exit 1
CMD ["node", "server/index.mjs"]