Install docker and docker-compose.
Duplicate .example.env file and rename it to .env
I wanted to have a starter kit for Phoenix projects that I would be able to run anywhere in docker. Alpine linux is used for all the docker images. If you use vscode - all the necessary extensions for developing phoenix application will be installed automatically inside the container
- Install https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack
- Open the folder in vscode and it should suggest you to reopen it inside the container
- After setting up the database (see the Get Started section to learn about that) you can add connection in postresql explorer. Use hostname
db, user and password from.envfile. If this doesn't work make sure gnome-keyring and libsecret are installed. - In
devcontainer.jsonsetelixir.projectPathandelixirLS.projectDirto the path to your project so elixir-ls extension starts working.
- Start shell session inside the container. For vscode users - just open the terminal (Ctrl + J) - it will already be inside the container. For others - run e.g.
docker exec -it phoenix-docker_app_1 sh - Create new phoenix project
mix phx.new your_project_nameand press enter to install dependencies when it prompts you - To set up postgres open
config/dev.exs, change hostname to"db", database to"database"and runmix ecto.createin your project folder - Run
iex -S mix phx.server
Open browser on localhost:4000