Deploying Weaverse Themes with Docker
Important: For production deployments, use Shopify Oxygen. Docker deployment is recommended only for development and testing.
Note: mini-oxygen in Docker simulates the Workers environment and requires environment variables to be set via .env
file, not through cloud platform settings.
For a complete working example, check out our Naturelle Demo Repository which demonstrates Docker deployment configuration in a real Weaverse theme project.
For other options to deploy your Hydrogen project, including platforms like Vercel, Netlify, and Cloudflare Workers, please refer to the Shopify documentation on self-hosting Hydrogen.
Understanding Docker Deployment
Docker deployment for Weaverse themes uses mini-oxygen, a Node.js-based simulation of the Shopify Workers environment. This approach has several important characteristics:-
Environment Simulation:
- Runs in Node.js instead of actual Workers runtime
- Some Worker-specific features might behave differently
- Useful for development and testing, but not ideal for production
-
Network Binding:
- Requires special handling for host binding (localhost → 0.0.0.0)
- Enables access from outside the container
- Essential for cloud deployment scenarios
-
Environment Variables:
- Must use
.env
file approach - Cloud platform environment settings won’t work
- Simulates Worker environment variable access
- Must use
Prerequisites
- Docker (latest stable version)
- Node.js (LTS version)
- Fly.io CLI (for Fly.io deployment)
- A Weaverse theme project
Configuration Files
1. Dockerfile
Create aDockerfile
in your project root:
2. .dockerignore
Create a.dockerignore
to optimize build context and improve security:
3. Environment Configuration
Create a.env
file in your project root:
Cloud Deployment (Fly.io)
1. Fly.io Configuration
Createfly.toml
:
2. Deployment Steps
- Initialize deployment:
- Deploy the application:
- Monitor deployment:
Troubleshooting Guide
Common Issues and Solutions
-
Build Failures:
- Verify Node.js version compatibility
- Check for missing dependencies
- Ensure Docker has enough resources
-
Runtime Errors:
- Check container logs:
fly logs
- Verify environment variables
- Confirm port configurations
- Check container logs:
-
Performance Issues:
- Monitor resource usage
- Check for memory leaks
- Verify network connectivity
Limitations and Considerations
-
Worker Environment Simulation:
- Not all Worker features are available
- Performance characteristics differ
- Some APIs might behave differently
-
Environment Variables:
- Must use
.env
file approach - No support for cloud platform env settings
- Careful management of sensitive data required
- Must use
-
Production Readiness:
- Consider using Shopify Oxygen for production
- Docker deployment best for development/testing
- Monitor resource usage and performance