Files
insta-recipe/Dockerfile
Giancarmine Salucci d36629d5f0
Some checks failed
Build & Push Docker Image / test-and-build (push) Failing after 38s
fix(ci): run only server tests in Docker tester stage
Playwright Chromium is not available in node:24-alpine, causing the
vitest 'client' project (browser tests) to fail with an unhandled
browserType.launch error and exit code 1.

- Dockerfile: switch tester stage command to
  'npm run test:unit -- --run --project=server'
  so only Node.js unit tests run during Docker builds
- page.svelte.spec.ts: update stale 'renders h1' assertion to match
  the new InstaChef design (no h1; check for 'InstaChef' logo text)

Browser component tests still run locally when Playwright/Chromium
is available.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-12 22:09:57 +02:00

44 lines
1.6 KiB
Docker

# ── stage: tester ────────────────────────────────────────────────────────────
FROM node:24-alpine AS tester
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
# Run only server-side unit tests; browser (Playwright) tests require a full
# Chromium environment that is not available in the Alpine build stage.
RUN npm run test:unit -- --run --project=server
# ── stage: builder ───────────────────────────────────────────────────────────
FROM node:24-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
# ── stage: runner ────────────────────────────────────────────────────────────
FROM node:24-alpine AS runner
WORKDIR /app
# Install yt-dlp (primary Instagram extractor) and Playwright system dependencies (fallback)
RUN apk add --no-cache \
python3 \
py3-pip \
chromium \
font-liberation \
font-noto \
font-noto-cjk && \
pip3 install --break-system-packages yt-dlp
COPY package*.json ./
RUN npm ci --omit=dev
COPY --from=builder /app/build ./build
EXPOSE 3000
ENV NODE_ENV=production
ENV CHROMIUM_EXECUTABLE_PATH=/usr/bin/chromium-browser
# Declare volume for Instagram authentication persistence
VOLUME ["/app/secrets"]
CMD ["node", "-e", "import('./build/index.js')"]