CoolFace
Apppublic

Pq234/robot-learning-tutorial

sourceHugging Faceupdated 11mo agoView on Hugging Face
0likes
Dockerfile72 linesDownload Raw Back to root
1# Use an official Node runtime as the base image for building the application2# Build with Playwright (browsers and deps ready)3FROM mcr.microsoft.com/playwright:v1.56.0-jammy AS build4 5# Install git, git-lfs, and dependencies for Pandoc (only if ENABLE_LATEX_CONVERSION=true)6RUN apt-get update && apt-get install -y git git-lfs wget && apt-get clean7 8# Install latest Pandoc from GitHub releases (only installed if needed later)9RUN wget -qO- https://github.com/jgm/pandoc/releases/download/3.8/pandoc-3.8-linux-amd64.tar.gz | tar xzf - -C /tmp && \10    cp /tmp/pandoc-3.8/bin/pandoc /usr/local/bin/ && \11    cp /tmp/pandoc-3.8/bin/pandoc-lua /usr/local/bin/ && \12    rm -rf /tmp/pandoc-3.813 14# Set the working directory in the container15WORKDIR /app16 17# Copy package.json and package-lock.json18COPY app/package*.json ./19 20# Install dependencies21RUN npm install22 23# Copy the rest of the application code24COPY app/ .25 26# Conditionally convert LaTeX to MDX if ENABLE_LATEX_CONVERSION=true27ARG ENABLE_LATEX_CONVERSION=true28RUN if [ "$ENABLE_LATEX_CONVERSION" = "true" ]; then \29    echo "🔄 LaTeX importer enabled - running latex:convert..."; \30    npm run latex:convert; \31    else \32    echo "⏭️  LaTeX importer disabled - skipping..."; \33    fi34 35# Ensure `public/data` is a real directory with real files (not a symlink)36# This handles the case where `public/data` is a symlink in the repo, which37# would be broken inside the container after COPY.38RUN set -e; \39    if [ -e public ] && [ ! -d public ]; then rm -f public; fi; \40    mkdir -p public; \41    if [ -L public/data ] || { [ -e public/data ] && [ ! -d public/data ]; }; then rm -f public/data; fi; \42    mkdir -p public/data; \43    cp -a src/content/assets/data/. public/data/44 45# Build the application46RUN npm run build47 48# Generate the PDF (light theme, full wait)49RUN npm run export:pdf -- --theme=light --wait=full50 51# Use an official Nginx runtime as the base image for serving the application52FROM nginx:alpine53 54# Copy the built application from the build stage55COPY --from=build /app/dist /usr/share/nginx/html56 57# Copy a custom Nginx configuration file58COPY nginx.conf /etc/nginx/nginx.conf59 60# Create necessary directories and set permissions61RUN mkdir -p /var/cache/nginx /var/run /var/log/nginx && \62    chmod -R 777 /var/cache/nginx /var/run /var/log/nginx /etc/nginx/nginx.conf63 64# Switch to non-root user65USER nginx66 67# Expose port 808068EXPOSE 808069 70# Command to run the application71CMD ["nginx", "-g", "daemon off;"]72