Files
insta-recipe/Dockerfile
T
Giancarmine SalucciandClaude Opus 4.8 5b19df87b2
Build & Push Docker Image / test-and-build (push) Failing after 46s
feat: adopt @mozempk/ig-auth shared Instagram session
Prefer the shared, kept-alive IG session (cookies + captured Chrome User-Agent)
over the manually-dropped secrets/cookies.txt, falling back to it when the shared
store is not configured. Dockerfile/CI resolve the scoped package via a BuildKit
secret.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-13 18:27:33 +02:00

49 lines
1.9 KiB
Docker

# syntax=docker/dockerfile:1
# ── stage: tester ────────────────────────────────────────────────────────────
FROM node:24-alpine AS tester
WORKDIR /app
COPY package*.json .npmrc ./
RUN --mount=type=secret,id=gitea_npm \
GITEA_NPM_TOKEN="$(cat /run/secrets/gitea_npm 2>/dev/null)" 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 .npmrc ./
RUN --mount=type=secret,id=gitea_npm \
GITEA_NPM_TOKEN="$(cat /run/secrets/gitea_npm 2>/dev/null)" 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 .npmrc ./
RUN --mount=type=secret,id=gitea_npm \
GITEA_NPM_TOKEN="$(cat /run/secrets/gitea_npm 2>/dev/null)" 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')"]