{"id":13682092,"url":"https://github.com/bitwalker/alpine-elixir-phoenix","last_synced_at":"2025-04-09T14:23:08.311Z","repository":{"id":42701170,"uuid":"49297337","full_name":"bitwalker/alpine-elixir-phoenix","owner":"bitwalker","description":"An Alpine Linux base image containing Elixir, Erlang, Node, Hex, and Rebar. Ready for Phoenix applications!","archived":false,"fork":false,"pushed_at":"2024-08-09T04:23:13.000Z","size":54,"stargazers_count":351,"open_issues_count":2,"forks_count":89,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-02-15T08:20:16.524Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitwalker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-01-08T21:16:20.000Z","updated_at":"2024-11-19T00:55:48.000Z","dependencies_parsed_at":"2024-08-02T13:21:42.780Z","dependency_job_id":"9396ffc2-c07a-4818-9cf5-9296125b70c3","html_url":"https://github.com/bitwalker/alpine-elixir-phoenix","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitwalker%2Falpine-elixir-phoenix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitwalker%2Falpine-elixir-phoenix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitwalker%2Falpine-elixir-phoenix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitwalker%2Falpine-elixir-phoenix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitwalker","download_url":"https://codeload.github.com/bitwalker/alpine-elixir-phoenix/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248054209,"owners_count":21039953,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T13:01:40.641Z","updated_at":"2025-04-09T14:23:08.266Z","avatar_url":"https://github.com/bitwalker.png","language":"Makefile","readme":"# Elixir/Phoenix on Alpine Linux\n\nThis Dockerfile provides everything you need to run your Phoenix application in Docker out of the box.\n\nIt is based on my `alpine-erlang` image, and installs Elixir (1.11.0), Node.js (12.18.x), Hex and Rebar. It can handle compiling\nyour Node and Elixir dependencies as part of it's build.\n\n## Usage\n\nNOTE: This image is intended to run in unprivileged environments, it sets the home directory to `/opt/app`, and makes it globally\nread/writeable. If run with a random, high-index user account (say 1000001), the user can run an app, and that's about it. If run\nwith a user of your own creation, this doesn't apply (necessarily, you can of course implement the same behaviour yourself).\nIt is highly recommended that you add a `USER default` instruction to the end of your Dockerfile so that your app runs in a non-elevated context.\n\nTo boot straight to a prompt in the image:\n\n```\n$ docker run --rm -it --user=1000001 bitwalker/alpine-elixir-phoenix iex\nErlang/OTP 23 [erts-11.1.1] [source] [64-bit] [smp:3:3] [ds:3:3:10] [async-threads:1]\n\nInteractive Elixir (1.11.0) - press Ctrl+C to exit (type h() ENTER for help)\niex(1)\u003e\n```\n\nExtending for your own application:\n\n```dockerfile\nFROM bitwalker/alpine-elixir-phoenix:latest\n\n# Set exposed ports\nEXPOSE 5000\nENV PORT=5000 MIX_ENV=prod\n\n# Cache elixir deps\nADD mix.exs mix.lock ./\nRUN mix do deps.get, deps.compile\n\n# Same with npm deps\nADD assets/package.json assets/\nRUN cd assets \u0026\u0026 \\\n    npm install\n\nADD . .\n\n# Run frontend build, compile, and digest assets\nRUN cd assets/ \u0026\u0026 \\\n    npm run deploy \u0026\u0026 \\\n    cd - \u0026\u0026 \\\n    mix do compile, phx.digest\n\nUSER default\n\nCMD [\"mix\", \"phx.server\"]\n```\n\nIt is recommended when using this that you have the following in `.dockerignore` when running `docker build`:\n\n```\n_build\ndeps\nassets/node_modules\ntest\n```\n\nThis will keep the payload smaller and will also avoid any issues when compiling dependencies.\n\n### Multistage Docker Builds\n\nYou can also leverage [docker multistage build](https://docs.docker.com/develop/develop-images/multistage-build/) and [bitwalker/alpine-elixir](https://github.com/bitwalker/alpine-elixir) to lower your image size significantly.\n\nAn example is shown below:\n\n```dockerfile\nFROM bitwalker/alpine-elixir-phoenix:latest AS phx-builder\n\n# Set exposed ports\nENV MIX_ENV=prod\n\n# Cache elixir deps\nADD mix.exs mix.lock ./\nRUN mix do deps.get, deps.compile\n\n# Same with npm deps\nADD assets/package.json assets/\nRUN cd assets \u0026\u0026 \\\n    npm install\n\nADD . .\n\n# Run frontend build, compile, and digest assets\nRUN cd assets/ \u0026\u0026 \\\n    npm run deploy \u0026\u0026 \\\n    cd - \u0026\u0026 \\\n    mix do compile, phx.digest\n\nFROM bitwalker/alpine-elixir:latest\n\nEXPOSE 5000\nENV PORT=5000 MIX_ENV=prod\n\nCOPY --from=phx-builder /opt/app/_build /opt/app/_build\nCOPY --from=phx-builder /opt/app/priv /opt/app/priv\nCOPY --from=phx-builder /opt/app/config /opt/app/config\nCOPY --from=phx-builder /opt/app/lib /opt/app/lib\nCOPY --from=phx-builder /opt/app/deps /opt/app/deps\nCOPY --from=phx-builder /opt/app/.mix /opt/app/.mix\nCOPY --from=phx-builder /opt/app/mix.* /opt/app/\n\n# alternatively you can just copy the whole dir over with:\n# COPY --from=phx-builder /opt/app /opt/app\n# be warned, this will however copy over non-build files\n\nUSER default\n\nCMD [\"mix\", \"phx.server\"]\n```\n\n## License\n\nMIT\n","funding_links":[],"categories":["Makefile"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitwalker%2Falpine-elixir-phoenix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitwalker%2Falpine-elixir-phoenix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitwalker%2Falpine-elixir-phoenix/lists"}