Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dockerfile: use Alpine image to build static binary
This patch switches the Dockerfile to use an Alpine Linux base image to build the static binary. Given that the binary is now fully static, a minimal image can be produced that only contains the essential artefacts. The static version of the Docker image does not contain the man- pages, so the existing (debian based) Dockerfile is kept, but renamed to Dockerfile.debian, and can be built by specifying the alternative Dockerfile using the `-f` flag: DOCKER_BUILDKIT=1 docker build -t jq:stretch -f Dockerfile.debian . With this patch applied, the image size is reduced drastically: DOCKER_BUILDKIT=1 docker build -t jq . docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE jq latest 7da2ea1c016d 5 seconds ago 800kB jq stretch-slim 4b7f380970f0 About a minute ago 70.3MB jq stretch c5fa8b766cd4 7 minutes ago 119MB The image can be tested, for example, by inspecting itself and pretty- printing the json: docker image inspect jq | docker run -i --rm jq . [ { "Id": "sha256:7da2ea1c016d97e7b52b09d5a323a1e7c0e4dbdbc77ce2715aedd3188721e4da", "RepoTags": [ "jq:latest", "jq:static" ], ... Signed-off-by: Sebastiaan van Stijn <[email protected]>
- Loading branch information