Compare commits

...

3 Commits

Author SHA1 Message Date
Bel LaPointe
72fca93e77 default -body=$BODY 2023-12-13 07:42:29 -07:00
Bel LaPointe
cf779e45f5 base alpine for shell over scratch 2023-12-12 08:59:50 -07:00
Bel LaPointe
7ecfae3229 docker build.sh teeny 4mb img woo 2023-12-12 08:47:39 -07:00
3 changed files with 20 additions and 1 deletions

11
Dockerfile Normal file
View File

@@ -0,0 +1,11 @@
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 alpine
RUN apk update && apk --no-cache upgrade
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

View File

@@ -32,7 +32,7 @@ func main() {
fail := flag.Bool("fail", false, "fail connections forever")
block := flag.Int("block", 0, "seconds to block connections")
status := flag.Int("status", http.StatusOK, "status to always return")
body := flag.String("body", "", "body to always return")
body := flag.String("body", envOrDefault("BODY", ""), "body to always return")
flag.Parse()
// start server