- Fix swagger-ui symlink in Dockerfile (was pointing to /opt/docfast instead of /app) - Add CSP directives to allow inline scripts/styles and Google Fonts - Add email-change.ts route with rate limiting (3/hr) and verification - Add updateKeyEmail to keys service - Add email-change route to index.ts with CORS support
32 lines
860 B
Docker
32 lines
860 B
Docker
FROM node:22-bookworm-slim
|
|
|
|
# Install Chromium and dependencies as root
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
chromium fonts-liberation \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Create non-root user
|
|
RUN groupadd --gid 1001 docfast \
|
|
&& useradd --uid 1001 --gid docfast --shell /bin/bash --create-home docfast
|
|
|
|
# Set environment variables
|
|
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
|
|
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
|
|
|
|
WORKDIR /app
|
|
COPY package*.json ./
|
|
RUN npm install --omit=dev
|
|
|
|
COPY dist/ dist/
|
|
COPY public/ public/
|
|
RUN rm -f public/swagger-ui && ln -s /app/node_modules/swagger-ui-dist public/swagger-ui
|
|
|
|
# Create data directory and set ownership to docfast user
|
|
RUN mkdir -p /app/data && chown -R docfast:docfast /app
|
|
|
|
# Switch to non-root user
|
|
USER docfast
|
|
|
|
ENV PORT=3100
|
|
EXPOSE 3100
|
|
CMD ["node", "dist/index.js"]
|