{"id":18606072,"url":"https://github.com/hfagerlund/erlang-experiments","last_synced_at":"2026-05-09T02:06:34.511Z","repository":{"id":164264918,"uuid":"155461241","full_name":"hfagerlund/erlang-experiments","owner":"hfagerlund","description":"Dockerizing an Erlang app","archived":false,"fork":false,"pushed_at":"2025-06-24T00:55:50.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-09T07:37:04.570Z","etag":null,"topics":["devcontainer","docker","docker-compose","erlang","rebar3"],"latest_commit_sha":null,"homepage":"","language":"Erlang","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/hfagerlund.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-10-30T21:54:45.000Z","updated_at":"2025-06-24T00:59:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"7228c47f-6779-4fb5-b5d5-385c43f5dd1b","html_url":"https://github.com/hfagerlund/erlang-experiments","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/hfagerlund/erlang-experiments","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hfagerlund%2Ferlang-experiments","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hfagerlund%2Ferlang-experiments/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hfagerlund%2Ferlang-experiments/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hfagerlund%2Ferlang-experiments/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hfagerlund","download_url":"https://codeload.github.com/hfagerlund/erlang-experiments/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hfagerlund%2Ferlang-experiments/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32804632,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"online","status_checked_at":"2026-05-09T02:00:06.633Z","response_time":123,"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":["devcontainer","docker","docker-compose","erlang","rebar3"],"created_at":"2024-11-07T02:24:11.811Z","updated_at":"2026-05-09T02:06:34.467Z","avatar_url":"https://github.com/hfagerlund.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"# erlang-experiments\n\nCreating a portable Erlang app development environment on Linux [using Docker] and adding [development containers (dev containers)].\n\n## Installation\nClone the repository using:\n```\n$ git clone https://github.com/hfagerlund/erlang-experiments.git\n```\n[Skip to 'Usage']\n\n\u003c!-- .................... --\u003e\n\u003cdetails\u003e\n  \u003csummary\u003eUsing Rebar3\u003cstrong\u003e[+]\u003c/strong\u003e\u003c/summary\u003e\n\n* Install the latest stable compiled version of [Rebar3]:\n```\n$ wget https://s3.amazonaws.com/rebar3/rebar3 \u0026\u0026 chmod +x rebar3\n```\n* Generate the app skeleton by running:\n```\n$ sudo docker run --name $APP_NAME -it --rm -v ${PWD}:/app -w /app erlang ./rebar3 new app $APP_NAME\n```\n... where `$APP_NAME` = 'erlang_experiments'.\n\u003c/details\u003e\n\u003c!-- .................... --\u003e\n\n## Usage\n\n### Docker Compose:\n\n* Using `Dockerfile` (below) -\n```\n# Updated official Erlang image from Docker Hub\nFROM erlang:24-alpine\n\n# Set working directory\nRUN mkdir /my-erlang-app\nWORKDIR /my-erlang-app\n\n# OPTIONAL: Uncomment the line below to keep container running indefinitely (for testing, debugging)\n## CMD [\"sleep\", \"infinity\"]\n\n# Copy application source code\nCOPY . .\n\n# compile small Erlang program 'hello.erl' (to produce a BEAM file that can execute on the Erlang VM):\nRUN erlc ./src/hello.erl\n\n# run sequential Erlang program as a common script, and exit\nRUN erl -noshell -run hello hallo there -s init stop\n## ...where:\n##    'hello' = module,\n##    'hallo' = function,\n##    'there' = argument (passed to the program)\n```\n\n* Using `docker-compose.yml` (below) -\n```\nversion: \"3.3\"\nservices:\n  ####################################################\n  # Web app\n  ####################################################\n  web:\n    build:\n      context: .\n      dockerfile: Dockerfile\n    ports:\n      - \"80:80\"\n    volumes:\n      # where VSCode looks for project's source code\n      # same as 'workspaceFolder' in .devcontainer/devcontainer.json\n      - ..:/workspace\n    # keep container running (for testing)\n    command: \"sleep infinity\"\n  ####################################################\n  # another service\n  ####################################################\n  # service-name:\n  # ...\n```\n\n\u003ca id=\"run-docker-compose\"\u003e\u003c/a\u003eRun docker-compose.yml as shown below:\u003cbr\u003e\n```\n# start Docker\n$ sudo systemctl start docker\n# create and start the app\n$ sudo docker compose up\n```\n\n#### Sample Output\nWith docker-compose.yml [running], do the following in another terminal tab:\n\n```\n$ sudo docker run -it --rm -v .:/app -w /app erlang ./rebar3 shell\n\n===\u003e Verifying dependencies...\n===\u003e Analyzing applications...\n===\u003e Compiling erlang_experiments\nErlang/OTP 28 [erts-16.0.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit:ns]\n\n===\u003e Booted erlang_experiments\nEshell V16.0.1 (press Ctrl+G to abort, type help(). for help)\n1\u003e c(hello).\nRecompiling /app/src/hello.erl\n{ok,hello}\n2\u003e eunit:test(erlang_experiments_test).\n  All 3 tests passed.\nok\n3\u003e eunit:test(erlang_experiments_test, [verbose]).\n======================== EUnit ========================\nmodule 'erlang_experiments_test'\n  erlang_experiments_test: hello_test...ok\n  erlang_experiments_test: hello_again_test...ok\n  erlang_experiments_test:14: -another_hello_test_/0-fun-0- (This test should also pass)...ok\n  [done in 0.009 s]\n=======================================================\n  All 3 tests passed.\nok\n4\u003e halt().\n\n```\n- - -\n### Dev Container\n\nDev Containers are an [open specification], and can be used without Visual Studio Code (VS Code), and/or without Docker.\n\nA '**/.devcontainer**' directory, and '**/.devcontainer/devcontainer.json**' file are required.\n\nFor example:\u003cbr\u003e\n`devcontainer.json` (below) -\n```\n{\n    \"name\": \"Erlang dev container\",\n    \"dockerComposeFile\": \"../docker-compose.yml\",\n    \"workspaceFolder\": \"/workspace\",\n    \"service\": \"web\"\n}\n```\n\u003e [!NOTE]\n\u003e Value of *'workspaceFolder'* should [match this line] in `docker-compose.yml`.\n\n#### Using Dev Container with VS Code\n1. **Install VS Code extension**:\u003cbr\u003e\nInstall '**Visual Studio Code Remote Development Extension Pack**' in Visual Studio Code from [extensions marketplace].\n\n2. **User Settings**:\u003cbr\u003e\nOpen Visual Studio Code (with extension installed):\n  * Ctrl + Shift + P \u003e *type*: open settings \u003e select '`Preferences: Open User Settings (JSON)`' \u003e opens 'settings.json' file \u003e save file in default location\n\n  For example:\u003cbr\u003e\n`settings.json` (below) -\n```\n$ cat ~/.config/Code/User/settings.json\n{\n    \"otherhost\": \"/foobar\"\n}\n```\n\n3. **Start Docker**:\u003cbr\u003e\nMake sure Docker is running, and correct **file permissions** are granted:\n```\n$ sudo systemctl start docker\n$ sudo chown -R $(whoami) ~/.docker\n```\n\n4. **Run dev container**:\u003cbr\u003e\nOpen Visual Studio Code (with extension installed):\n  * Open **root directory** of project repo (`$ git clone https://github.com/hfagerlund/erlang-experiments.git`))\n  * Ctrl + Shift + P \u003e select '`Dev Containers: run in container`' command\n\n\u003e [!TIP]\n\u003e Use VS Code's `Dev Containers: Rebuild Container` command for your container to update if contents of the `.devcontainer` directory have been modified.\n\n- - -\n## License\nCopyright (c) 2018 Heini Fagerlund. Licensed under the [MIT License].\n\n\u003c!-- References --\u003e\n\u003c!-- internal --\u003e\n[match this line]: https://github.com/hfagerlund/erlang-experiments/blob/71c50843eca7c9f9e8258a8f1c3c4330e819f3dd/docker-compose.yml#L12\n[MIT License]: https://github.com/hfagerlund/erlang-experiments/blob/master/LICENSE\n[running]: #run-docker-compose\n[Skip to 'Usage']: #usage\n\n\u003c!-- external --\u003e\n[development containers (dev containers)]: https://containers.dev/\n[extensions marketplace]: https://marketplace.visualstudio.com/search?target=VSCode\u0026category=Extension%20Packs\u0026sortBy=Installs\n[open specification]: https://containers.dev/\n[Rebar3]: https://github.com/erlang/rebar3\n[using Docker]: https://www.docker.com/\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhfagerlund%2Ferlang-experiments","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhfagerlund%2Ferlang-experiments","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhfagerlund%2Ferlang-experiments/lists"}