marpit-backend / Dockerfile
pvanand's picture
Update Dockerfile
fd5226a verified
# Use Node.js 16 as the base image
FROM node:16
# Install Chromium and LibreOffice
RUN apt-get update && apt-get install -y \
chromium \
libreoffice \
fonts-liberation \
# Additional dependencies that might be needed
libx11-xcb1 \
libxcomposite1 \
libxcursor1 \
libxdamage1 \
libxi6 \
libxtst6 \
libnss3 \
libcups2 \
libxss1 \
libxrandr2 \
libasound2 \
libpangocairo-1.0-0 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libgtk-3-0 \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
# Create app directory
WORKDIR /usr/src/app
# Install app dependencies
COPY package*.json ./
RUN npm install
# Bundle app source
COPY . .
# Create tmp directory and set permissions
RUN mkdir -p /tmp/marp-work && \
chown -R node:node /tmp/marp-work
# Create a non-root user
RUN groupadd -r nodeuser && useradd -r -g nodeuser nodeuser \
&& chown -R nodeuser:nodeuser /usr/src/app
# Set environment variable for Chromium
ENV CHROME_PATH=/usr/bin/chromium
# Switch to non-root user
USER nodeuser
# Expose the port the app runs on
EXPOSE 7860
# Start the application
CMD ["node", "index.js"]