{"id":17258607,"url":"https://github.com/bobbyrbruce/docker-cross-compilation-example","last_synced_at":"2026-07-12T04:30:18.255Z","repository":{"id":198418326,"uuid":"700799410","full_name":"BobbyRBruce/docker-cross-compilation-example","owner":"BobbyRBruce","description":"An example of using docker to cross compile.","archived":true,"fork":false,"pushed_at":"2023-10-05T10:21:26.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-31T10:35:11.715Z","etag":null,"topics":["buildx","cross-compilation","docker","docker-compse"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","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/BobbyRBruce.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}},"created_at":"2023-10-05T10:13:41.000Z","updated_at":"2024-07-11T15:48:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"2bffc145-13b1-48f5-beab-6f4eb61616fc","html_url":"https://github.com/BobbyRBruce/docker-cross-compilation-example","commit_stats":null,"previous_names":["bobbyrbruce/docker-cross-compilation-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BobbyRBruce%2Fdocker-cross-compilation-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BobbyRBruce%2Fdocker-cross-compilation-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BobbyRBruce%2Fdocker-cross-compilation-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BobbyRBruce%2Fdocker-cross-compilation-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BobbyRBruce","download_url":"https://codeload.github.com/BobbyRBruce/docker-cross-compilation-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240553249,"owners_count":19819770,"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":["buildx","cross-compilation","docker","docker-compse"],"created_at":"2024-10-15T07:21:17.208Z","updated_at":"2026-07-12T04:30:16.193Z","avatar_url":"https://github.com/BobbyRBruce.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker Cross Compilation Example\n\nThis is a simple example of how to use Docker to cross compile an application.\n\n## Structure\n\n* `Dockerfile` - The Dockerfile that defines the Docker image to be used in\nCross compilation. This file must define all the environment variables, tools\nand dependencies needed for compilation. Of note, this Dockerfile is agnostic\nto the platform being compiled for. It is only concerned with the tools and\ndependencies needed for compilation.\n* `docker-compose.yml` - The docker-compose file defines the platforms the\nDocker images are to be built for, the files loaded from the host to the\ncontainers created from these images, and the commands to be run.\n\nThe remainder of the repository is the source code for the application and the\nMakefile that defines the build process. This will vary from application to\napplication.\n\n## Setting up `docker buildx`\n\nThe host machine must have `docker buildx` installed. Please consult\n\u003chttps://github.com/docker/buildx\u003e for instructions on how to install this.\n\nWhat is required is that your bootstrapped `docker buildx` instance has\nbuilders for each of the architectures you wish to compile for. In this\nexample, we are compiling for `amd64`, `arm64` and `riscv64`. To create\nthese builds, we execute the following commands:\n\n```bash\ndocker buildx create --use --name mybuild node-amd64\ndocker buildx create --append --name mybuild node-arm64\ndocker buildx create --append --name mybuild node-riscv64\n```\n\nHere a new builder, `mybuild` is created for `amd64` then appended to with the\n`arm64` and `riscv64`. The `--use` flag is used to set the builder as the\ndefault.\n\n## Usage\n\nAll you need to do to create the cross compiled binaries is run:\n\n```bash\ndocker-compose up\n```\n\nFor each architecture to be compiled to this command, by reading the\n`docker-compose.yml` file, will create an Image from the Dockerfile\nfor that architecture, create a container from that image, mount the local\nsource code into the container, then build and return the compiled product.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbobbyrbruce%2Fdocker-cross-compilation-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbobbyrbruce%2Fdocker-cross-compilation-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbobbyrbruce%2Fdocker-cross-compilation-example/lists"}