https://github.com/jhermann/docker-golang-hi
:whale2: Example of a multi-stage golang build, with a run container ‘from scratch’
https://github.com/jhermann/docker-golang-hi
Last synced: 7 months ago
JSON representation
:whale2: Example of a multi-stage golang build, with a run container ‘from scratch’
- Host: GitHub
- URL: https://github.com/jhermann/docker-golang-hi
- Owner: jhermann
- License: mit
- Created: 2018-10-12T13:03:29.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-10-18T10:10:33.000Z (almost 8 years ago)
- Last Synced: 2025-02-02T08:45:12.198Z (over 1 year ago)
- Language: Dockerfile
- Size: 3.91 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
================
docker-golang-hi
================
:Name: jhermann/gohi
:Description: A golang multi-stage build container image example.
:Maintainer: Jürgen Hermann
The following commands build and run a golang binary from the source in ``hi.go``,
putting it into a from-scratch Docker image.
.. code-block:: shell
docker build -t jhermann/gohi -t jhermann/gohi:$(git describe --tags) .
docker run --rm -it jhermann/gohi
It doesn't get easier than this. ☺
The resulting image is only slightly larger than the contained golang binary.
.. code-block:: console
$ dockviz images --tree jhermann/gohi
└─927b6ad2e4fa Virtual Size: 1.4 MB Tags: jhermann/gohi:latest, jhermann/gohi:v0-1-g93bf073
To look at the image's metadata, use ``docker inspect``:
.. code-block:: shell
docker inspect jhermann/gohi:latest | jq -CS
Leave out the ``jq`` part if you don't have that installed,
it just colorizes the output.
Using `prom/busybox:glibc` instead of `scratch` adds 6 MB in size,
a shell, and the other debugging and introspection conveniences of a full base image.