This page contains information about changes between each versions and how you can migrate from one version to another.

Morph 0.2.1 to 0.3.0

Dockerfile Update: Frontend Build

In v0.3.0, frontend build has been added. If you are running morph deploy from a local environment, please update your Dockerfile as follows:

FROM node:lts AS morph-frontend-build

WORKDIR /var/task

# Copy source code and dependencies
COPY . .

RUN npm install
RUN npm run build

# Base image for Morph Cloud
FROM public.ecr.aws/i1l4z0u0/morph-data:python3.12

# Set working directory
WORKDIR /var/task

# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt --target "\${MORPH_PACKAGE_ROOT}"

# Copy source code and dependencies
COPY . .

COPY --from=morph-frontend-build /var/task/.morph .morph
COPY --from=morph-frontend-build /var/task/dist dist

# Command to run the Lambda function
CMD python "\${MORPH_APP_FILE_PATH}"

morph_project.yml Update

In v0.3.0, the configuration of morph_project.yml has been changed. Please refer to this reference for details.

version: "1"

# Framework Settings
default_connection: DUCKDB
source_paths:
  - src

# Cloud Settings
profile: default # Defined in the Profile Section in `~/.morph/credentials`
project_id: xxxxxx-xxxxx-xxxx-xxxxx

# Build Settings
build:
  # These settings are required when there is no Dockerfile in the project root.
  # They define the environment in which the project will be built
  runtime: python3.9 # python3.9, python3.10, python3.11, python3.12
  framework: morph # morph | streamlit
  package_manager: pip # pip, poetry, uv
  # These settings are required when there is a Dockerfile in the project root.
  # They define how the Docker image will be built
  context: .
  build_args:
    ARG1: value1
    ARG2: value2

# Deployment Settings
deployment:
  provider: aws
  aws:
    region: us-east-1
    memory: 512
    timeout: 30
  gcp:
    region: us-central1
    memory: "1Gi"
    cpu: 1
    concurrency: 80
    timeout: 300

Frontend Update

In v0.3.0, the frontend project structure has been changed.

Please follow these steps to update your project for migration:

  1. After installing morph-data~=0.3, run the following command
    • Run this command in the project root.
    • If you are using venv or virtualenv, make sure to run it with the virtual environment activated.
  2. [Only if you had additional npm packages installed] Manually reinstall any packages you had installed.
python <<EOF
import morph
import os
import shutil
import subprocess

morph_data_installed_dir = os.path.dirname(morph.__file__)
starter_template_dir = os.path.join(
    morph_data_installed_dir, "include", "starter_template"
)

def migrate_frontend():
    def copy_starter_template_file(path: str):
        src = os.path.join(starter_template_dir, path)
        dst = os.path.join(os.getcwd(), path)

        os.makedirs(os.path.dirname(dst), exist_ok=True)
        shutil.copy(src, dst)

    # Copy files
    copy_starter_template_file("vite.config.ts")
    copy_starter_template_file("tsconfig.json")
    copy_starter_template_file("package.json")
    copy_starter_template_file("components.json")
    copy_starter_template_file("src/pages/_app.tsx")
    copy_starter_template_file("src/pages/404.tsx")
    copy_starter_template_file("src/pages/index.css")
    copy_starter_template_file("src/pages/_lib/utils.ts")
    copy_starter_template_file("src/pages/_components/table-of-contents.tsx")
    copy_starter_template_file("src/pages/_components/header.tsx")

    # Init components
    subprocess.run(
        [
            "npx",
            "shadcn@latest",
            "add",
            "--yes",
            "https://morph-components.vercel.app/r/morph-components.json",
        ],
    )

    subprocess.run(
        [
            "npm",
            "install",
        ],
    )

if __name__ == "__main__":
    migrate_frontend()

EOF

Morph 0.1.9 to 0.2.0

Dockerfile Update: CMD Command Changes

The method for installing the execution command for apps built with Morph in the deployment environment has changed for the Github integration. Specifically, it has changed from copying the api/app.py file in the .morph/core/morph directory created in the local environment to the deployment environment, to executing files installed as a package. As a result, the entry point in the dockerfile has also changed for v0.2.0 and later when executing morph deploy.

With the v0.2.0 changes, the CMD command generated by the morph new command in the Dockerfile has been updated, so if you are using previous versions, please update your CMD command.

# Base image for Morph Cloud
FROM public.ecr.aws/i1l4z0u0/morph-data:python3.9

# Set working directory
WORKDIR /var/task

# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt --target "${MORPH_PACKAGE_ROOT}"

# Copy source code and dependencies
COPY . .

# Command to run the Lambda function
CMD python "${MORPH_APP_FILE_PATH}"

Adding the /static Directory

In v0.2.0, a /static directory was added to host static files. Files placed under /static can be accessed from the frontend application.

# Example of displaying an image file placed in the `/static` directory

![Logo](/static/logo.png)

If you are using a previous version, please create the /static directory.

Morph 0.1.7 to 0.1.8

Dockerfile Update: Improved Streaming for <LLM /> and <Chat /> Components

Due to improvements in LLM streaming response behavior, the base image and CMD settings in the Dockerfile have been updated.

For v0.1.8 and later, the Dockerfile generated by the morph new command will be initialized with the following structure:

# Base image for Morph Cloud
FROM public.ecr.aws/i1l4z0u0/morph-data:python3.9

# Set working directory
WORKDIR /var/task

# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt --target "${MORPH_TASK_ROOT}"

# Copy source code and dependencies
COPY . .

# Command to run the Lambda function
CMD ["python", ".morph/core/morph/api/app.py"]

Additionally, a .dockerignore file is now generated during initialization, and the COPY command has been modified to copy the entire directory while excluding files specified in .dockerignore, rather than copying individual files.

This means you no longer need to update the Dockerfile when the directory structure changes in your local development environment.