Files
iptvnator/docker/Dockerfile
T
4gray 23512411a0 build(docker): move image to node 24 and install pnpm without corepack (#1265)
Supersedes #1250, whose 22 -> 26 bump failed the image build: `corepack enable`
exits 127 because Node 25 unbundled Corepack.

Both stages move to node:24-alpine, the current LTS line — Node 26 stays
Current until October 2026, which is the wrong target for a self-hosted runtime
image. pnpm is installed globally at the exact `packageManager` version, with
the `+sha512...` suffix stripped, so the next base-image major is a one-line
change instead of a broken build.
2026-07-26 19:54:52 +02:00

54 lines
1.8 KiB
Docker

# The Nx builds below emit platform-independent JS/static assets. During
# multi-arch publish builds, keep that heavy build stage on the native builder
# platform instead of running Node/Nx through QEMU for linux/arm64.
FROM --platform=$BUILDPLATFORM node:24-alpine AS build
RUN apk add --no-cache python3 make g++ git
WORKDIR /usr/src/app
COPY .npmrc ./
COPY package.json pnpm-lock.yaml ./
COPY patches ./patches
# Node 25 unbundled Corepack, so `corepack enable` cannot be the way pnpm gets
# installed here — it would break on the next base-image major. Install the
# exact pnpm from `packageManager` instead, which stays reproducible.
RUN PNPM_VERSION="$(node -p 'require("./package.json").packageManager.split("@")[1].split("+")[0]')" \
&& npm install --global "pnpm@${PNPM_VERSION}" \
&& pnpm install --frozen-lockfile --ignore-scripts
COPY . .
# CI passes the git commit so Settings > About shows "<version> (<sha>)";
# the inject script is a no-op when BUILD_COMMIT is empty (local builds).
ARG BUILD_COMMIT=""
RUN node tools/build/inject-build-commit.mjs
RUN pnpm nx build web --configuration=pwa
RUN pnpm nx build web-backend
FROM node:24-alpine
RUN apk add --no-cache gettext nginx
WORKDIR /opt/iptvnator
ENV PORT=3000
ENV BACKEND_URL=/api
ENV CLIENT_URL=http://localhost:4333
COPY --from=build /usr/src/app/dist/apps/web /usr/share/nginx/html
COPY --from=build /usr/src/app/dist/apps/web-backend ./web-backend
COPY docker/nginx.conf /etc/nginx/http.d/default.conf.template
COPY docker/docker-entrypoint.sh /usr/local/bin/iptvnator-entrypoint
RUN chmod +x /usr/local/bin/iptvnator-entrypoint
EXPOSE 80
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD wget -qO- http://127.0.0.1/api/health >/dev/null || exit 1
CMD ["iptvnator-entrypoint"]