A Phoenix Framework docker image, based on the Elixir Alpine image
2.1K
This repo builds a Phoenix Framework docker image.
The image is based on the Elixir Alpine docker image.
GitHub: https://github.com/aviumlabs/phoenix-img
For the latest changes: CHANGELOG.md
The image naming convention is divided between Standard and Extended.
It is based on similar projects running Alpine Linux, where -alpine is
appended to the end of the tag.
The Standard naming convention will attempt to be based on the latest version of Alpine, Erlang, Elixir, and the Phoenix Framework except in the case of where a conflict arises.
The Extended naming convention may either be based on the previous stable version of Elixir or the cutting edge version of Elixir.
aviumlabs/phoenix:<version | latest>-alpine
Where version is either numeric based on the Phoenix version or the literal 'latest'.
aviumlabs/phoenix:<version | latest>-elixir<version>-alpine
This is the default - builds the latest version of Phoenix Framework.
Regular build
docker build --no-cache -t aviumlabs/phoenix:latest-alpine .
Build with sbom and provenance
docker build --no-cache -t aviumlabs/phoenix:latest-alpine --provenance=mode=max --sbom=true .
Update Base Image with Build
docker build --pull --no-cache -t aviumlabs/phoenix:latest-alpine .
With sbom and provenance
docker build --pull --no-cache -t aviumlabs/phoenix:latest-alpine --provenance=mode=max --sbom=true .
To build a specific version of Phoenix Framework; pass in the Phoenix version you want to build:
export PHX_VERSION=1.8.8
To build release candidate 4 of Phoenix 1.8:
export PHX_VERSION=1.8.0-rc0
Replace aviumlabs with your docker namespace:
docker build --pull --no-cache -t aviumlabs/phoenix:$PHX_VERSION-alpine \
--build-arg PHX_VERSION=$PHX_VERSION --provenance=mode=max --sbom=true .
Run the docker image and confirm Alpine version, PostgreSQL client version.
Run container in the foreground:
export APP_NAME=app
docker run --name app -it -e APP_NAME=$APP_NAME --rm -p 4000:4000 -w "/opt/phoenix/$APP_NAME" --mount type=bind,src="$(pwd)/src",target="/opt/phoenix/$APP_NAME" aviumlabs/phoenix:latest-alpine
docker run --name app -it -e APP_NAME=$APP_NAME --rm -p 4000:4000 -w "/opt/phoenix/$APP_NAME" --mount type=bind,src="$(pwd)/src",target="/opt/phoenix/$APP_NAME" aviumlabs/phoenix:$PHX_VERSION-alpine
Open an additional shell:
docker exec -it app /bin/ash
cat /etc/alpine-release
3.23.5
psql --version
psql (PostgreSQL) 18.4
elixir --version
Erlang/OTP 29 ...
Elixir 1.20.1 ...
This docker image is designed to work with the host filesystem and the GitHub repository is a template repository.
To create your initial application development environment run the
gh repo create command.
General command
gh repo create <application_name> -c -d "Application description" \
--private|--public -p aviumlabs/phoenix
Flags
Example
gh repo create myapp -c -d "My First Application" --private \
-p aviumlabs/phoenix
Created repository <github_userid>/myapp on GitHub https://github.com/\<github_userid>/myapp Cloning into myapp...
The directory structure will now look like this:
During the first-time run, the application will be configured, and the src directory will be populated with the baseline Phoenix Framwork application.
export APP_NAME=app
docker run --name myapp -it -e APP_NAME=$APP_NAME --rm -p 4000:4000 -w "/opt/phoenix/$APP_NAME" --mount type=bind,src="$(pwd)/src",target="/opt/phoenix/$APP_NAME" aviumlabs/phoenix:latest-alpine
Generated myapp app
[info] Running MyappWeb.Endpoint with Bandit 1.12.4 at 0.0.0.0:4000 (http)
[info] Access MyappWeb.Endpoint at http://localhost:4000
[watch] build finished, watching for changes...
= tailwindcss v4.3.0 ...
/*! ... daisyUI 5.5.20 */
Done in 322ms.
Browsing to http://localhost:4000 will show you the default landing page of a Phoenix Framework application.
And listing the contents of src directory will show you the standard Phoenix Framework application layout.
As a development environment, live_reload is active.
Edit src/lib/my_webapp/controllers/page_html/home.html.eex
Search for Phoenix Framework and insert some text like MyApp powered by Phoenix Framework.
Save the file and go back to your browser and you will automatically see the change.
Pretty awesome! Much gratitude and appreciation to the Phoenix Framework, Elixir, Erlang, Alpine, and PostgreSQL teams for their amazing work!
Have fun!
References
There is a companion project to this project for building a Phoenix Framework project integrated with PostgreSQL.
https://github.com/aviumlabs/phoenix-compose.git
The aviumlabs/phoenix-compose repo is also a template repository.
The services included are:
In a separate terminal session, confirm the application is running:
curl -X 'GET' http://localhost:4000
... ... <iframe hidden height="0" width="0" src="/phoenix/live\_reload/frame">\</iframe>\</body> </html>\<!-- \</AppWeb.Layouts.root> -->Output from app runtime terminal:
[info] GET /
[debug] Processing with AppWeb.PageController.home/2
Parameters: %{}
Pipelines: [:browser]
[info] Sent 200 in 760µsPress ctrl-c a to stop running app
Docker Hub
Internal notes for pushing images to Docker Hub.
docker push aviumlabs/phoenix:<tagname>-alpinedocker push aviumlabs/phoenix:$PHX_VERSION-alpinedocker push aviumlabs/phoenix:latest-alpineProject Tags
Release Tag v1.4.0
This tag is pinned to the Elixir docker image - elixir:1.20-alpine.
- Alpine Linux 3.23.x
- Erlang 29.x
- Elixir 1.20.x
- Phoenix Framework 1.8.x
Release Tag v1.3.0
This tag is pinned to the Elixir docker image - elixir:1.19-alpine.
- Alpine Linux 3.23.x
- Erlang 28.x
- Elixir 1.19.x
- Phoenix Framework 1.8.x
Release Tag v1.2.0
This release is pinned to the Elixir docker image - elixir:1.18-alpine.
08-30-2025 Stack
- Alpine Linux 3.22
- Erlang 28.0.2
- Elixir 1.18.3
- Phoenix Framework 1.8.1
These versions are subject to change at build time.
Release Tag v1.1.0
Includes Igniter and Tidewav.ai
Release Tag v1.0.0
This release is pinned to the Elixir docker image - elixir:1.17-alpine.
02-02-2025 Stack
- Alpine Linux 3.21
- Erlang 27.2.4
- Elixir 1.17.3
- Phoenix Framework 1.7.20
These versions are subject to change at build time.
Content type
Image
Digest
sha256:b843d99ad…
Size
147.1 MB
Last updated
23 days ago
docker pull aviumlabs/phoenix:latest-alpine