Files
gashboard/Dockerfile
Dorian b827f89dcd fix: serve SPA from apps/web/dist (matches server default) + use Datum IP
Two production-blocker bugs from the first deploy:

1. Static SPA never served — Dockerfile copied apps/web/dist into
   apps/api/public, but server.ts default static dir resolves to
   apps/web/dist. Mismatch meant every route fell through to Express'
   bare 404 ("Cannot GET /"). Aligning Dockerfile to the default path.

2. DNS for the Datum container name failed (getaddrinfo ENOTFOUND
   datum_datum_1) — gashboard's Docker DNS doesn't reliably alias
   external-network container names across compose stacks. Switch the
   default DATUM_URL to the container's known IP on umbrel_main_network
   (10.21.0.11, captured during earlier diagnostics). If the IP changes
   the user can override DATUM_URL in env. If gashboard isn't actually
   joined to umbrel_main_network, the next failure will be a much more
   diagnostic ECONNREFUSED instead of an opaque ENOTFOUND.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 16:47:56 +01:00

46 lines
1.5 KiB
Docker

# TODO(security): pin this base by SHA256 before shipping to production.
# Resolve with:
# docker pull node:22.12.0-alpine
# docker inspect --format='{{index .RepoDigests 0}}' node:22.12.0-alpine
# then replace `node:22.12.0-alpine` below with `node@sha256:<digest>`.
ARG NODE_IMAGE=node:22.12.0-alpine
FROM ${NODE_IMAGE} AS deps
WORKDIR /app
# Avoid Corepack — Node 22 ships a Corepack that strict-validates pnpm
# signatures and breaks behind builders that can't reach the signing host.
RUN npm install -g pnpm@9.12.3 --no-fund --no-audit && npm cache clean --force
COPY pnpm-workspace.yaml package.json pnpm-lock.yaml tsconfig.base.json ./
COPY apps/api/package.json apps/api/
COPY apps/web/package.json apps/web/
RUN pnpm install --frozen-lockfile
FROM deps AS build-api
WORKDIR /app
COPY apps/api apps/api
RUN pnpm --filter @gashboard/api build
FROM deps AS build-web
WORKDIR /app
COPY apps/web apps/web
RUN pnpm --filter @gashboard/web build
FROM ${NODE_IMAGE} AS runtime
WORKDIR /app
ENV NODE_ENV=production
RUN apk add --no-cache wget tini \
&& npm install -g pnpm@9.12.3 --no-fund --no-audit \
&& npm cache clean --force
COPY pnpm-workspace.yaml package.json pnpm-lock.yaml ./
COPY apps/api/package.json apps/api/
RUN pnpm install --filter @gashboard/api --prod --frozen-lockfile
COPY --from=build-api /app/apps/api/dist apps/api/dist
COPY --from=build-web /app/apps/web/dist apps/web/dist
USER node
EXPOSE 1337
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["node", "apps/api/dist/index.js"]