GithubHelp home page GithubHelp logo

jhermann / docker-golang-hi Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 4 KB

:whale2: Example of a multi-stage golang build, with a run container ‘from scratch’

License: MIT License

Dockerfile 94.65% Go 5.35%

docker-golang-hi's Introduction

docker-golang-hi

Name

jhermann/gohi

Description

A golang multi-stage build container image example.

Maintainer

Jürgen Hermann <[email protected]>

The following commands build and run a golang binary from the source in hi.go, putting it into a from-scratch Docker image.

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.

$ 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:

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.

docker-golang-hi's People

Contributors

jhermann avatar

Stargazers

John McKenzie avatar  avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.