A simple Docker setup for Supabase.
- Remove some unnecessary services, including
realtime,storageandfunction. - Add support for OAuth providers.
- Add support for EMail Template.
- Add SSL support.
- Docker
- Docker Compose
- Git
git clone https://github.com/alex-guoba/supabase-docker.git
cd supabase-docker
cp .env.example .env
# Edit .env file to your needs
# Start Supabase
docker compose up -d
# Stop Supabase
docker compose downAfter running docker compose up -d, you can access Supabase at http://127.0.0.1:8000.
You can configure Supabase by editing the .env file.
SITE_URL: The URL of your Application.API_EXTERNAL_URL: The URL of your Supabase Instance.
Add OAuth provider to auth section of docker-compose file. For example, to add Github OAuth provider:
# Github OAuth config in auth.enviroment
GOTRUE_EXTERNAL_GITHUB_ENABLED: true
GOTRUE_EXTERNAL_GITHUB_CLIENT_ID: ${GITHUB_CLIENT_ID}
GOTRUE_EXTERNAL_GITHUB_SECRET: ${GITHUB_CLIENT_SECRET}
GOTRUE_EXTERNAL_GITHUB_REDIRECT_URI: ${AUTH_REDIRECT_URL}Note that you need to set GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET in your .env file.
After adding the provider, You can use the API to verify the configuration of your OAuth providers:
curl 'https://<PROJECT_REF>.supabase.co/auth/v1/settings' \
-H "apikey: <ANON_KEY>" \
-H "Authorization: Bearer <ANON_KEY>"Like the official Supabase, you can use SMTP to send emails. In your .env file, add the following:
SMTP_ADMIN_EMAIL=
SMTP_HOST=
SMTP_PORT=
SMTP_USER=
SMTP_PASS=
SMTP_SENDER_NAME=See Supabase SMTP for more details.
You can customize the email templates by editing the files in ./docker-compose.yml.
GOTRUE_MAILER_TEMPLATES_RECOVERY: ${MAILER_TEMPLATES_RECOVERY}
GOTRUE_MAILER_TEMPLATES_INVITE: ${MAILER_TEMPLATES_INVITE}
GOTRUE_MAILER_TEMPLATES_CONFIRMATION: ${MAILER_TEMPLATES_CONFIRMATION}
GOTRUE_MAILER_TEMPLATES_MAGIC_LINK: ${MAILER_TEMPLATES_MAGIC_LINK}
GOTRUE_MAILER_TEMPLATES_EMAIL_CHANGE: ${MAILER_TEMPLATES_EMAIL_CHANGE}Set your environment value in .env:
MAILER_TEMPLATES_INVITE="https://example.com/templates/invite.html"
MAILER_TEMPLATES_CONFIRMATION="https://example.com/templates/confirm.html"
MAILER_TEMPLATES_RECOVERY="https://example.com/templates/recovery.html"
MAILER_TEMPLATES_MAGIC_LINK="https://example.com/templates/magic-link.html"
MAILER_TEMPLATES_EMAIL_CHANGE="https://example.com/templates/email-change.html"Generate your cert and key files and copy it to ./volumns/ssl/ directory. In your .env file, add the following:
SSL_CERT="example.crt"
KONG_SSL_CERT_KEY="example.key"API Keys, Secrets, and other configurations can be found in the official Supabase documentation. Make sure to update your .env file accordingly.
See Docker Configuration for more details.
All development is done in the main branch.
There is a develop docker file for development. You can override the docker-compose.yml file to use it:
docker compose -f docker-compose.yml -f ./dev/docker-compose.dev.yml up
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.