Patrick Rathje
add example extraction
e5509f7
raw
history blame
1.66 kB
FROM python:3.10-slim
# Install Node to run Motion Canvas
WORKDIR /tmp/node
RUN apt-get update && apt-get install -y nodejs npm
# without v prefix!
ARG MC_VERSION="3.17.2"
ENV NODE_ENV=$MC_VERSION
WORKDIR /motion-canvas
RUN yes '' | npm init -y @motion-canvas@$MC_VERSION
WORKDIR /motion-canvas/my-animation
ENV MC_PROJECT_DIR=/motion-canvas/my-animation
# copy the vite.config.ts file to the project to get deterministic output filenames under dist/project.js
COPY docker/vite.config.ts ./vite.config.ts
# if we build here, we have to clean up the project every time before building a new one...
RUN npm install
RUN npm run build
# clone examples
#ENV MC_EXAMPLE_PROJECTS_DIR=/motion-canvas/examples
#RUN git clone https://github.com/motion-canvas/examples /motion-canvas/example-projects
ENV MC_DIR=/motion-canvas/motion-canvas
ENV MC_DOCS_DIR=/motion-canvas/motion-canvas/packages/docs
RUN git clone https://github.com/motion-canvas/motion-canvas /motion-canvas/motion-canvas
ENV MC_EXAMPLE_SCENES_DIR=/motion-canvas/motion-canvas/packages/examples/src/scenes
# docs/docs and docs/api should be interesting resources
RUN git clone https://github.com/motion-canvas/motion-canvas.github.io /motion-canvas/docs
# Install Gradio and copy local files
WORKDIR /app
RUN pip install --no-cache-dir gradio[mcp] gradio_motioncanvasplayer
COPY . .
RUN mkdir -p /app/public
ENV MC_EXAMPLES_MD_FILE=/app/public/examples.md
RUN python extract_examples.py $MC_EXAMPLES_MD_FILE
RUN useradd -m -u 1000 user
RUN chown -R user:user /motion-canvas
RUN chown -R user:user /app
USER user
EXPOSE 7860
ENV GRADIO_SERVER_NAME="0.0.0.0"
CMD ["python", "app.py"]