- Add WASM settings page for configuring external AGPL modules - Implement dynamic loading for PyMuPDF, Ghostscript, and CoherentPDF - Add Cloudflare Worker proxy for serving WASM files with CORS - Update all affected tool pages to check WASM availability - Add showWasmRequiredDialog for missing module configuration Documentation: - Update README, licensing.html, and docs to clarify AGPL components are not bundled and must be configured separately - Add WASM-PROXY.md deployment guide with recommended source URLs - Rename "CPDF" to "CoherentPDF" for consistency
58 lines
1.7 KiB
Docker
58 lines
1.7 KiB
Docker
# Global variable declaration:
|
|
# Build to serve under Subdirectory BASE_URL if provided, eg: "ARG BASE_URL=/pdf/", otherwise leave blank: "ARG BASE_URL="
|
|
ARG BASE_URL=
|
|
|
|
# Build stage
|
|
FROM node:20-alpine AS builder
|
|
WORKDIR /app
|
|
COPY package*.json ./
|
|
COPY vendor ./vendor
|
|
ENV HUSKY=0
|
|
RUN npm config set fetch-retries 5 && \
|
|
npm config set fetch-retry-mintimeout 60000 && \
|
|
npm config set fetch-retry-maxtimeout 300000 && \
|
|
npm config set fetch-timeout 600000 && \
|
|
npm ci
|
|
COPY . .
|
|
|
|
# Build without type checking (vite build only)
|
|
# Pass SIMPLE_MODE environment variable if provided
|
|
ARG SIMPLE_MODE=false
|
|
ENV SIMPLE_MODE=$SIMPLE_MODE
|
|
ARG COMPRESSION_MODE=all
|
|
ENV COMPRESSION_MODE=$COMPRESSION_MODE
|
|
|
|
# global arg to local arg
|
|
ARG BASE_URL
|
|
ENV BASE_URL=$BASE_URL
|
|
|
|
RUN if [ -z "$BASE_URL" ]; then \
|
|
npm run build -- --mode production && \
|
|
npm run docs:build && \
|
|
node scripts/include-docs-in-dist.js; \
|
|
else \
|
|
npm run build -- --base=${BASE_URL} --mode production && \
|
|
npm run docs:build && \
|
|
node scripts/include-docs-in-dist.js; \
|
|
fi
|
|
|
|
# Production stage
|
|
FROM nginxinc/nginx-unprivileged:stable-alpine-slim
|
|
|
|
LABEL org.opencontainers.image.source="https://github.com/alam00000/bentopdf"
|
|
LABEL org.opencontainers.image.url="https://github.com/alam00000/bentopdf"
|
|
|
|
# global arg to local arg
|
|
ARG BASE_URL
|
|
|
|
# Set this to "true" to disable Nginx listening on IPv6
|
|
ENV DISABLE_IPV6=false
|
|
|
|
COPY --chown=nginx:nginx --from=builder /app/dist /usr/share/nginx/html${BASE_URL%/}
|
|
COPY --chown=nginx:nginx nginx.conf /etc/nginx/nginx.conf
|
|
COPY --chown=nginx:nginx --chmod=755 nginx-ipv6.sh /docker-entrypoint.d/99-disable-ipv6.sh
|
|
RUN mkdir -p /etc/nginx/tmp && chown -R nginx:nginx /etc/nginx/tmp
|
|
|
|
EXPOSE 8080
|
|
CMD ["nginx", "-g", "daemon off;"]
|