Patrick Rathje
Do not install everytime for new projects
b1a5ae8
raw
history blame
1.19 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_DIR=/motion-canvas/examples
RUN git clone https://github.com/motion-canvas/examples /motion-canvas/examples
# docs/docs and docs/api should be interesting resources
ENV MC_DOCS_DIR=/motion-canvas/docs
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
EXPOSE 7860
ENV GRADIO_SERVER_NAME="0.0.0.0"
CMD ["python", "app.py"]