go build -o sample-binary sample.go
./sample-binary
GOOS=linux go build -o sample-binary sample.go
./sample-binary
docker run -v $(PWD):/root -it --rm alpine:latest /root/sample-binary
docker build . -t golang-deploy-examples-single:latest -f Dockerfile-single
build the Dockerfile using Dockerfile-single, produces a golang:alpine image with all os deps, stripping debug and using upx
docker build . -t golang-deploy-examples-single-optimized:latest -f Dockerfile-single-optimized
build the Dockerfile using Dockerfile-stages, produces an alpine and copies binary from previous docker step
docker build . -t golang-deploy-examples-stages:latest -f Dockerfile-stages
build the Dockerfile using Dockerfile-stages-optimized, produces an alpine and copies binary from previous docker step, stripping debug and using upx
docker build . -t golang-deploy-examples-stages-optimized:latest -f Dockerfile-stages-optimized
docker build . -t golang-deploy-examples-scratch:latest -f Dockerfile-scratch
docker run -dt --restart always -m 64M --name golang-deploy-examples-scratch golang-deploy-examples-scratch:latest
docker logs golang-deploy-examples-scratch --follow
docker stats
docker stop golang-deploy-examples-scratch
docker rm golang-deploy-examples-scratch
docker rmi golang-deploy-examples-single:latest docker rmi golang-deploy-examples-stages:latest docker rmi golang-deploy-examples-stages-optimized:latest docker rmi golang-deploy-examples-single-optimized:latest docker rmi golang-deploy-examples-scratch:latest