https://github.com/fuxu/gohello-from-scratch
Example of putting a Golang service into docker scratch image
https://github.com/fuxu/gohello-from-scratch
docker docker-image docker-scratch golang multi-stage-build
Last synced: 25 days ago
JSON representation
Example of putting a Golang service into docker scratch image
- Host: GitHub
- URL: https://github.com/fuxu/gohello-from-scratch
- Owner: fuxu
- License: mit
- Created: 2018-02-07T15:15:41.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-23T12:14:34.000Z (about 8 years ago)
- Last Synced: 2025-10-30T16:45:13.956Z (7 months ago)
- Topics: docker, docker-image, docker-scratch, golang, multi-stage-build
- Language: Go
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
gohello
==========
This is an example of putting a golang service into docker scratch image
It is almost the smallest possiable docker image
Prepare
----------
```
$ tar cv --files-from /dev/null | docker import - scratch
```
Docker Version < 17.05
----------
```
$ sh build.sh
```
Docker Version >= 17.05
----------
```
$ docker build -t fuxu/gohello -f Dockerfile.multi-stage .
```
Run
----------
```
$ docker run -it --rm -p 8080:8080 --name hello fuxu/gohello
```
Reference:
----------
- https://docs.docker.com/engine/userguide/eng-image/baseimages/#create-a-simple-parent-image-using-scratch
- https://medium.com/@adriaandejonge/simplify-the-smallest-possible-docker-image-62c0e0d342ef
- https://docs.docker.com/develop/develop-images/multistage-build/