Files
afilmory/Dockerfile.core
Innei 9f436c63d3 chore(docker): update Dockerfile to include runtime dependencies for image processing
- Added perl, perl-image-exiftool, vips, and libheif to the Dockerfile for enhanced image processing capabilities.
- These dependencies support exiftool functionality and enable HEIF/HEIC support in libvips.

Signed-off-by: Innei <tukon479@gmail.com>
2025-11-13 00:46:25 +08:00

53 lines
1.8 KiB
Core

# syntax=docker/dockerfile:1.7
FROM node:lts-alpine AS builder
ENV PNPM_HOME=/pnpm
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable && corepack prepare pnpm@10.19.0 --activate
WORKDIR /workspace
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml ./
COPY be/apps/core/package.json be/apps/core/package.json
COPY be/apps/dashboard/package.json be/apps/dashboard/package.json
COPY apps/web/package.json apps/web/package.json
RUN pnpm fetch --filter core...
RUN pnpm fetch --filter '@afilmory/web...'
RUN pnpm fetch --filter '@afilmory/dashboard...'
COPY . .
RUN pnpm install --filter core... --filter '@afilmory/web...' --filter '@afilmory/dashboard...' --frozen-lockfile
RUN pnpm --filter @afilmory/web build:serve
RUN pnpm --filter @afilmory/dashboard build
RUN pnpm --filter core build
RUN mkdir -p be/apps/core/dist/static/web && cp -r apps/web/dist/* be/apps/core/dist/static/web/
RUN mkdir -p be/apps/core/dist/static/dashboard && cp -r be/apps/dashboard/dist/* be/apps/core/dist/static/dashboard/
FROM node:lts-alpine AS runner
ENV NODE_ENV=production
WORKDIR /app
# Runtime deps for image processing:
# - perl: required by exiftool-vendored on Linux
# - perl-image-exiftool: provides the exiftool binary (optional but useful)
# - vips: runtime library for sharp
# - libheif: enable HEIF/HEIC support in libvips when available
RUN apk add --no-cache perl perl-image-exiftool vips libheif
COPY --from=builder /workspace/be/apps/core/dist ./dist
COPY --from=builder /workspace/be/packages/db/migrations ./migrations
COPY --from=builder /workspace/be/apps/core/docker-entrypoint.sh ./docker-entrypoint.sh
RUN chmod +x ./docker-entrypoint.sh
RUN if [ -f dist/package.json ]; then \
cd dist && \
npm install --omit=dev --no-audit --no-fund; \
fi
EXPOSE 1841
ENTRYPOINT ["./docker-entrypoint.sh"]
CMD ["node", "./dist/main.js"]