Sign inSign up

jeffdecola/compact-multi-stage-build-example

By jeffdecola

•Updated over 3 years ago

Using docker to multi-stage build a docker image containing the alpine OS.

Image
0

305

jeffdecola/compact-multi-stage-build-example repository overview

⁠compact-multi-stage-build-example

Docker Pulls MIT License jeffdecola.com

Using docker to multi-stage build a docker image containing the alpine OS.

GitHub Repo⁠

⁠DOCKERFILE

  • Using docker to multi-stage build a docker image containing the alpine OS
  • Dockerfile⁠
  • Dockerhub image⁠
  • Size: ~14MB
  • Source Image: docker
    • "golang:alpine" for docker on linux
  • Custom Image: docker
    • alpine 3.17.2 for docker on linux
  • Contains:
    • hello program compiled using go

⁠BUILD IMAGE AND PUSH TO DOCKERHUB

build-push.sh⁠ contains,

DOCKER_BUILDKIT=0 docker build -t jeffdecola/compact-multi-stage-build-example .
docker push jeffdecola/compact-multi-stage-build-example

Obviously, you will have to edit and create an account at dockerhub.

⁠DEPLOY IMAGE

To run on your machine, I suggest,

docker pull jeffdecola/compact-multi-stage-build-example
docker run --name compact-multi-stage-build-example -dit jeffdecola/compact-multi-stage-build-example

To bash shell into the container and check versions,

docker exec -i -t compact-multi-stage-build-example /bin/bash
cat /etc/os-release

To see the output,

docker logs -f compact-multi-stage-build-example

Tag summary

Content type

Image

Digest

sha256:15be71799…

Size

6.8 MB

Last updated

over 3 years ago

docker pull jeffdecola/compact-multi-stage-build-example