Files
rental-contract-pdf/Dockerfile
2026-05-15 15:18:03 +08:00

31 lines
672 B
Docker

FROM node:20-bookworm-slim
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libreoffice-writer \
fonts-noto-cjk \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .
RUN if [ -d fonts ] && ls fonts/*.{ttf,otf,ttc} 2>/dev/null | grep -q .; then \
mkdir -p /usr/local/share/fonts/custom && \
cp fonts/*.ttf fonts/*.otf fonts/*.ttc /usr/local/share/fonts/custom/ 2>/dev/null || true && \
fc-cache -f; \
fi
ENV NODE_ENV=production
ENV PORT=3000
ENV TEMPLATE_DIR=/app/templates
ENV TEMP_DIR=/tmp/rental-contracts
ENV SOFFICE_BIN=soffice
EXPOSE 3000
CMD ["npm", "start"]