docker build.sh teeny 4mb img woo

master
Bel LaPointe 2023-12-12 08:47:39 -07:00
parent 0d80d2ea3c
commit 7ecfae3229
2 changed files with 18 additions and 0 deletions

10
Dockerfile Normal file
View File

@ -0,0 +1,10 @@
FROM golang:1.21-bullseye as builder
COPY . /go/src/app
WORKDIR /go/src/app
RUN GOOS=linux CGO_ENABLED=0 go build -o /bin/app -a -installsuffix cgo -trimpath -ldflags "-s -w" -tags musl
FROM scratch
COPY --from=builder /bin/app /bin/
CMD []
ENTRYPOINT ["/bin/app"]

8
build.sh Normal file
View File

@ -0,0 +1,8 @@
#! /bin/bash
set -euo pipefail
docker rmi k3d-test:5001/gitea/echo-server:latest || true
docker build -t k3d-test:5001/gitea/echo-server:latest .
docker images | grep k3d-test:5001/gitea/echo-server
docker push k3d-test:5001/gitea/echo-server:latest