Introduction
Alfred is a development environment for applications using Docker. It's not a replacement for Docker Compose but a simpler way to use docker when you develop sites or applications for customers.
No windows support (yet, pull request?).
Check out the examples.
Setup
Before using Alfred you have to point all *.dev
domains to localhost.
Proxy container
Alfred requires a proxy container like nginx or Caddy to proxy domains to the right container.
The first time you use Alfred to start the proxy container, the type flag is optional to switch proxy container. Default proxy container is Caddy.
The proxy containers will only bind port 80 and not 443 (yet, pull request?).
alfred proxy start [--type=nginx]
You can stop the proxy container with alfred proxy stop
or delete the Docker container.
Application container
You're application don't need a configuration file but it's recommended since the default configuration may not work for you're application. If you just have HTML site it's easy. Checkout the HTML example.
{
"path": "./public"
}
If you need some more advanced or running PHP or some other language you need to configure which image is used and maybe environment variables.
{
"image": "isotopab/php:7.0-apache",
"env": [
"SITEPATH=/var/www/html/public"
]
}
When you ready with your configuration you just run alfred start
in the same directory as the alfred.json
exists in, if no config file exists in will use the default configuration which are configured for a HTML site.
Configuration
The real configuration used for starting a application container can be view running alfred config
. This shows the HTML example configuration.
{
"env": [
"VIRTUAL_HOST=html.dev",
"VIRTUAL_PORT=2015"
],
"files": [],
"image": "joshix/caddy",
"host": "html.dev",
"links": [],
"port": 2015,
"path": "/u/go/src/github.com/frozzare/alfred/examples/html/public:/var/www/html:ro"
}
All values can be modified with alfred.json
. The host value is based on your folder if no config value exists.
Specific configuration documentation.
files
array should contain file paths both local and host, e.g ./test.php:/var/www/html/public
, note that Alfred mountes the application volume as read write so files will be written to host system. So gitignore or something like that is recommended to ignore those files.
host
string is based on your folder if no config value exists, can contain tld.
links
array should contain container names, e.g redis
or redis3:redis
License
MIT © Fredrik Forsmo