This is elixir and phoenix development docker file
711
Alpine Linux-based images, containing the following:
These images include the latest versions (at build-time) of Phoenix, Erlang and NodeJS. The Elixir version can be specified using Docker Tags.
The included Phoenix version is useful when starting new Phoenix projects. You aren't, however, required to use the preinstalled version. If a newer version of Phoenix is available, you can install- and use that instead.
Run any command like so:
docker run --rm -v $(pwd):/cwd -ti mrrooijen/phoenix [command]
When leaving out the command, it'll default to /bin/sh.
To generate a new Phoenix project, execute the following command:
docker run --rm -v $(pwd):/cwd -ti mrrooijen/phoenix mix phoenix.new my_new_app
If you want to use a version of Phoenix newer than the one provided in this image, you can install it manually prior to generating a new project:
docker run --rm -v $(pwd):/cwd -ti mrrooijen/phoenix
mix archive.install https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez
mix phoenix.new my_new_app
When working on an existing project, simply use mix deps.get to pull in all dependencies, including the Phoenix version that your application is using.
If you need to extend this image you can easily do so by creating your own Dockerfile. For example, if your program depends on PostgreSQL, you'll need to install the PostgreSQL client like so:
FROM mrrooijen/phoenix:latest
RUN apk --no-cache add postgresql-client
Use Docker Compose to setup a development environment. Here's a typical Phoenix configuration:
Add docker-compose.yml:
web:
build: .
dockerfile: Dockerfile.local
command: mix phoenix.server
ports:
- 4000:4000
volumes:
- .:/cwd
links:
- db
db:
image: postgres
Add Dockerfile.local:
FROM mrrooijen/phoenix
RUN apk --no-cache add postgresql-client
Update config/dev.exs and config/test.exs and change the Repo's hostname from localhost to db, which'll resolve to the private ip associated with the linked db.
Then, before anything else, install the deps and create the database:
docker-compose run web mix deps.get
docker-compose run web mix ecto.create
Run tests with:
docker-compose run web mix test
Boot the stack with:
docker-compose up
Whenever you make changes to Dockerfile.local you'll have rebuild using:
docker-compose build
If using Docker in production, create a separate Dockerfile.
Released under the MIT License by Michael van Rooijen.
Content type
Image
Digest
Size
41.9 MB
Last updated
about 10 years ago
docker pull appunite/phoenix