{"id":13568041,"url":"https://github.com/bake-bake-bake/bakeware","last_synced_at":"2025-10-03T19:30:37.935Z","repository":{"id":37754526,"uuid":"294470474","full_name":"bake-bake-bake/bakeware","owner":"bake-bake-bake","description":"Compile Elixir applications into single, easily distributed executable binaries","archived":true,"fork":false,"pushed_at":"2024-09-18T13:56:42.000Z","size":18036,"stargazers_count":1418,"open_issues_count":17,"forks_count":46,"subscribers_count":29,"default_branch":"main","last_synced_at":"2025-09-21T06:49:19.702Z","etag":null,"topics":["elixir","erlang","hacktoberfest","spawnfest-2020"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bake-bake-bake.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2020-09-10T16:57:24.000Z","updated_at":"2025-08-27T09:29:44.000Z","dependencies_parsed_at":"2025-01-22T19:36:01.062Z","dependency_job_id":"97100e6a-8b25-4d2d-a93f-7c70fdd9de2b","html_url":"https://github.com/bake-bake-bake/bakeware","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/bake-bake-bake/bakeware","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bake-bake-bake%2Fbakeware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bake-bake-bake%2Fbakeware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bake-bake-bake%2Fbakeware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bake-bake-bake%2Fbakeware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bake-bake-bake","download_url":"https://codeload.github.com/bake-bake-bake/bakeware/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bake-bake-bake%2Fbakeware/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278217052,"owners_count":25950032,"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","status":"online","status_checked_at":"2025-10-03T02:00:06.070Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["elixir","erlang","hacktoberfest","spawnfest-2020"],"created_at":"2024-08-01T14:00:19.288Z","updated_at":"2025-10-03T19:30:37.530Z","avatar_url":"https://github.com/bake-bake-bake.png","language":"C","readme":"# Bakeware\n\n[![CircleCI](https://circleci.com/gh/bake-bake-bake/bakeware.svg?style=svg)](https://circleci.com/gh/bake-bake-bake/bakeware)\n[![Hex version](https://img.shields.io/hexpm/v/bakeware.svg \"Hex version\")](https://hex.pm/packages/bakeware)\n[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/bakeware/)\n[![Total Download](https://img.shields.io/hexpm/dt/bakeware.svg)](https://hex.pm/packages/bakeware)\n[![License](https://img.shields.io/hexpm/l/bakeware.svg)](https://hex.pm/packages/bakeware)\n[![Last updated](https://img.shields.io/github/last-commit/bake-bake-bake/bakeware.svg)](https://github.com/bake-bake-bake/bakeware/commits/main)\n\n# Bakeware is no longer maintained. Please see [Burrito](https://github.com/burrito-elixir/burrito).\n\nCompile Elixir applications into single, easily distributed executable binaries\n\n![The Bakeware oven](https://raw.githubusercontent.com/bake-bake-bake/bakeware/main/assets/bakeware_logo200.png)\n\n\u003e Bakeware was made over a weekend at [SpawnFest 2020](https://spawnfest.github.io/)\n\u003e and thanks to the response from the community, we're working on finishing it\n\u003e off. While it's not ready for production, it's definitely ready for\n\u003e experimentation - just expect APIs to change in the near-term. If you'd like\n\u003e to help, please let us know and stay tuned!\n\nBakeware extends [Mix\nreleases](https://hexdocs.pm/mix/1.10.4/Mix.Tasks.Release.html) with the ability\nto turn Elixir projects into single binaries that can be copied and directly\nrun. No need to install Erlang or untar files. The binaries look and feel like\nthe build-products from other languages.\n\nHere's a quick list of features:\n\n* Simple - add the `bakeware` dependency and the Bakeware assembler to your Mix\n  release settings\n* Supports OSX, Linux and Windows (we wrote the code with the BSDs in mind,\n  so support may not be far off)\n* [Zstandard compression](https://en.wikipedia.org/wiki/Zstandard) for smaller\n  binaries\n* Optional support for automatic software updates (work in progress)\n* Command-line argument passing conveniences\n* Lots of examples\n\nThis README contains the basics of making your applications work with `Bakeware`\nand reference material for when you need to dig into how it works.\n\nSince everything was written quickly and the integration is fairly\nstraightforward, we recommend that you take a look at the examples. The examples\nare bare bones Elixir scripts, OTP applications, Phoenix applications and more\nwith small changes to their `mix.exs` files and instructions for running that\nyou can try out for yourself.\n\n## Using\n\n### Mix release\n\nBakeware supports tieing in executable binary assembly into a Mix release\nas a step by using the `Bakeware.assemble/1` function.\n\n\u003c!-- ASSEMBLE !--\u003e\nThis will assemble the necessary components to create a Bakeware executable\nthat can be distributed across machines to run the script/application without\nextra environment setup (such as installing Elixir/Erlang, etc)\n\nTo use, add this to your release as a step after assembly:\n\n```elixir\ndef release do\n  [\n    demo: [\n      steps: [:assemble, \u0026Bakeware.assemble/1]\n    ]\n  ]\nend\n```\n\nBakeware adds the following options in the release scoped to `:bakeware` key:\n\n* `:compression_level` - Zstandard compression level (1 to 19) where higher\n  numbers generally result in better compression, but are slower to build\n* `:start_command` - The start script command to run when invoked. This defaults\n  to `\"start\"`, but can be changed to `\"start_iex\"`, for example, if you want a\n  prompt. See [`Mix.Release`](https://hexdocs.pm/mix/Mix.Tasks.Release.html#module-bin-release_name-commands)\n  for supported commands.\n\n```elixir\ndef release do\n  [\n    demo: [\n      bakeware: [\n        compression_level: 1,\n        start_command: \"daemon\"\n      ]\n    ]\n  ]\nend\n```\n\n\u003c!-- ASSEMBLE !--\u003e\n\n### Scripting\n\n\u003c!-- SCRIPT !--\u003e\nBakeware supports an API similar to Erlang's escript for implementing a `main`\nfunction. Here's an example module:\n\n```elixir\ndefmodule MyApp.Main do\n  use Bakeware.Script\n\n  @impl Bakeware.Script\n  def main(_args) do\n    IO.puts \"Hello, World!\"\n    0\n  end\nend\n```\n\nThe return value sets the scripts exit status (0 for success and other values\nfor errors). Other value types are supported. See\n[`:erlang.halt/2`](https://erlang.org/doc/man/erlang.html#halt-2) for how these\nwork.\n\nNext, add this module to your `mix.exs`'s application description. This usually\nlooks something like this:\n\n```elixir\n  def application do\n    [\n      extra_applications: [:logger],\n      mod: {Myapp.Main, []}\n    ]\n  end\n```\n\nWhy does the module get added to `:mod`? Everything with Bakeware operates on\nOTP Releases. The macros in `Bakeware.Script` add the scaffolding to invoke your\n`main/1` function from the release.\n\u003c!-- SCRIPT !--\u003e\n\n## Tips\n\n### Minimizing executable size\n\nBakeware binaries appear to have a lower bound of about 12 MB in size. We expect\nthat they can be made smaller out-of-the-box, but here are a few things you can\ndo:\n\n1. Make sure `zstd` is installed to enable compression during assembly:\n  * **MacOS**: `brew install zstd`\n  * **Ubuntu**: `apt-get install zstd`\n  * **Windows**: `choco install zstandard`\n2. Build using `MIX_ENV=prod`. The default is `MIX_ENV=dev`, so be sure that the\n   environment variable is set.\n3. Run `rm -fr _build` and then `mix release`. During development cruft builds\n   up in the release directory. Bakeware can't tell the difference between the\n   important files and the cruft, so executables will slowly grow in size if you\n   don't do a clean build.\n4. Inspect your `_build/prod/rel/\u003cname\u003e` directory and especially under `lib`\n   for files or dependencies that you might be including on accident.\n5. Make sure that compile-time dependencies are marked as `runtime: false` in\n   your `mix.exs` so that they're not included\n6. Try raising the compression Zstandard compression level by setting\n  `:compression_level` in the `mix.exs` release config\n\n### Erlang distribution\n\nBakeware uses [Mix releases](https://hexdocs.pm/mix/Mix.Tasks.Release.html) and\ninherits the default of starting of Erlang distribution. If you're using\nBakeware for commandline or other short-lived applications, this unnecessarily\nstarts Erlang distribution servers running and prevents two application\ninstances from running at a time.\n\nTo disable, run `mix release.init` to create starter `env.sh.eex` and\n`env.bat.eex` files in the `rel` directory. Then edit the files to set\n`RELEASE_DISTRIBUTION=none`.\n\n### Creating cross-platform binaries\n\nBakeware binaries include the Erlang runtime but there are still dependencies on\nthe host system. These include the C runtime and other libraries referenced by\nthe Erlang runtime and any NIFs and ports in your application. Luckily, the\nbinary ABIs of many libraries are very stable, but if distributing to a wide\naudience, it's useful to build on a system with older library versions. Python\nhas a useful pointers in their [packaging\nguides](https://packaging.python.org/guides/packaging-binary-extensions/#building-binary-extensions).\n\n### Static Compiling OpenSSL into Erlang Distribution\n\nSometimes wierd SSL state bugs arise with a release when openssl is not statically compiled in.\nYou're affected by these ssl issues if you see things like an SSL connection being established but\nafter sending the first packet the remote end drops you. Attached is a Dockerfile that can be\nbuilt with Podman and used to build your baked released.\n\n```\n#Edit the versions of libraries in Dockerfile\nENV SSL_VERSION=1.1.1j\nENV OTP_VERSION=OTP-23.1.4\nENV ELIXIR_VERSION=v1.11.3\n\n#Build erlang with static openssl\npodman build --tag mybuilder DockerfileFolder/\n\n#Bake your release\npodman run -it --rm -v .:/root/myproject --entrypoint bash mybuilder -c \"cd /root/myproject \u0026\u0026 ./build.sh\"\n\n#Build.sh\nexport MIX_ENV=prod\nrm -rf _build\nmix deps.get\nmix release\ncp _build/prod/rel/bakeware/myproject .\n```\n\n### Building on Windows\n\nBakeware is tested to work in mingw environment on Windows 8 and 10. In order to setup the environment follow these steps:\n\n* Install [`chocolatey`](https://chocolatey.org/install)\n* Install elixir, zstandard, make, and mingw using chocolatey: `choco install -y elixir zstandard make mingw`\n* Change the default `MAKE` environment variable used by `elixir_make` from `nmake` to `make` (set it permanently to get rid of the errors in VSCode)\n* Set the CC environment variable\n* Build the release\n\n#### PowerShell\n\n```powershell\n$env:MAKE=\"make\"\n$env:CC=\"gcc\"\nmix release\n```\n\n#### Command Prompt\n\n```\nset MAKE=make\nset CC=gcc\nmix release\n```\n\n#### MinGW\n\nNote: after building the release in MinGW, you need to switch back to PowerShell/CMD to run the application\n\n```bash\nexport MAKE=make\nexport CC=gcc\nmix release\n```\n\n## Reference material\n\n### Command-line arguments\n\nIn general, command-line arguments passed to Bakeware applications are passed through to Elixir. A few special command-line arguments can be passed to adjust the launchers behavior. Bakeware stops parsing command-line arguments when it encounters a `--`. Processed command-line arguments are not passed along to Elixir.\n\nThe following arguments may be passed:\n\n* `--bw-info` - Print out information about the application and exit\n* `--bw-gc` - This cleans up all unused entries in the cache (NOT IMPLEMENTED)\n* `--bw-install` - Unpack the application to the cache only. Do not run.\n* `--bw-system-install` - Install to a system-wide location (NOT IMPLEMENTED)\n* `--bw-command` - use the specified [`Mix.Release` command](https://hexdocs.pm/mix/Mix.Tasks.Release.html#module-bin-release_name-commands) when running the executable\n\n### Environment variables\n\nThe Bakeware launcher sets the following environment variables for use in Elixir:\n\nVariable name                       | Description\n ---------------------------------- | --------------------------\n`BAKEWARE_EXECUTABLE`               | The absolute path to the executable\n`BAKEWARE_ARG1`                     | The first command-line argument\n`BAKEWARE_ARGn`                     | The nth command-line argument\n`BAKEWARE_ARGC`                     | The number of arguments\n\nSee the [Scripting](#scripting) section of this document for a more user friendly API.\n\n### Binary format\n\nBakeware application binaries look like this:\n\n* Bakeware application launcher\n* A CPIO archive of an Erlang/OTP release\n* Trailer\n\nThe CPIO archive can be compressed. This depends on the contents of the trailer.\n\nTrailer format (multi-byte fields are big endian):\n\nOffset from end | Field           | Type           | Description\n -------------- | --------------- | -------------- | -----------\n-4              | Magic           | 4 byte string  | Set to \"BAKE\"\n-5              | Trailer version | 8-bit integer  | Set to 1\n-6              | Compression     | 8-bit integer  | 0 = No compression, 1 = Zstandard\n-8              | Flags           | 16-bit integer | Set to 0 (no flags yet)\n-12             | Contents offset | 32-bit integer | Offset of CPIO archive\n-16             | Contents length | 32-bit integer | Length of CPIO archive\n-48             | SHA1            | 20 bytes       | SHA-1 of the CPIO archive\n\n## Cache directory\n\nBakeware maintains a cache of extracted binaries. This is needed to run the\nOTP releases and it enables start-time optimizations.\n\nThe default cache directory location is system-specific:\n\n* Windows - `\"C:/Users/\u003cUSER\u003e/AppData/Local/Bakeware/cache\"`\n* MacOS - `\"~/Library/Caches/Bakeware\"`\n* Linux and other Unixes - `\"~/.cache/bakeware\"`\n\nYou can override it by setting the `$BAKEWARE_CACHE` environment variable.\n\nHere's the layout of each cache entry:\n\nPath                                | Created by | Description\n ---------------------------------- | ---------- | --------------------------\n`$CACHE_DIR/$SHA1/bin`              | CPIO       | OTP release's `bin` directory\n`$CACHE_DIR/$SHA1/erts-x.y.z`       | CPIO       | OTP release's ERTS\n`$CACHE_DIR/$SHA1/lib`              | CPIO       | OTP release's `lib` directory\n`$CACHE_DIR/$SHA1/releases`         | CPIO       | OTP release's `releases` directory\n`$CACHE_DIR/$SHA1/start`            | CPIO       | Start script. E.g., `bin/my_otp_release start`\n\n## LICENSE\n\nAll code is licensed under Apache-2.0 with the exception of [`zstd`](https://github.com/bake-bake-bake/bakeware/tree/main/src/zstd) which is dual licensed BSD/GPL. See it's [LICENSE](https://github.com/bake-bake-bake/bakeware/blob/main/src/zstd/LICENSE) and [COPYING](https://github.com/bake-bake-bake/bakeware/blob/main/src/zstd/COPYING) files for more details.\n","funding_links":[],"categories":["C","Tooling"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbake-bake-bake%2Fbakeware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbake-bake-bake%2Fbakeware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbake-bake-bake%2Fbakeware/lists"}