We've introduced an experimental flag to the Supabase CLI, which allows you to deploy Edge Functions without running Docker.
How to use#
_10npx supabase@beta functions deploy --use-api
This also simplifies importing files outside the supabase/ directory within Edge Functions. Useful for monorepo setups where you want to share code between your frontend and Edge Functions.
For example, Given the directory layout below, you can import my-lib from either index.ts or deno.json.
_11my-repo/_11├─ my-app/_11│ ├─ supabase/_11│ │ │ functions/_11│ │ │ │ slug/_11│ │ │ │ ├─ index.ts_11│ │ │ │ ├─ deno.json_11├─ my-lib/_11│ ├─ src/_11│ │ ├─ index.ts_11├─ README.md
The new flag is available from the Supabase CLI beta releases 2.13.3. Please check CLI upgrade guide on how to use the beta releases on your machine.
CI#
We also recommend using the --use-api flag if you deploy Edge Functions via CI. This should speed up the deploys as it no longer requires Docker and also solves a race condition previously occurred when deploying multiple functions in parallel.
Here's an example GitHub Action config:
_24name: Deploy Function_24_24on:_24 push:_24 branches:_24 - main_24 workflow_dispatch:_24_24jobs:_24 deploy:_24 runs-on: ubuntu-latest_24_24 env:_24 SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}_24 PROJECT_ID: your-project-id_24_24 steps:_24 - uses: actions/checkout@v3_24_24 - uses: supabase/setup-cli@v1_24 with:_24 version: 2.13.3_24_24 - run: supabase functions deploy --use-api --project-ref $PROJECT_ID
Note: If you run into any issues with the --use-api, you can drop the flag to use the default Docker-based deploy mechanism.
Note 2: To run/ test Edge Functions locally (supabase functions serve), you will still need Docker. This only modifies deploy behavior.