Compare commits
3 Commits
0d80d2ea3c
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72fca93e77 | ||
|
|
cf779e45f5 | ||
|
|
7ecfae3229 |
11
Dockerfile
Normal file
11
Dockerfile
Normal 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
8
build.sh
Normal 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
|
||||||
2
main.go
2
main.go
@@ -32,7 +32,7 @@ func main() {
|
|||||||
fail := flag.Bool("fail", false, "fail connections forever")
|
fail := flag.Bool("fail", false, "fail connections forever")
|
||||||
block := flag.Int("block", 0, "seconds to block connections")
|
block := flag.Int("block", 0, "seconds to block connections")
|
||||||
status := flag.Int("status", http.StatusOK, "status to always return")
|
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()
|
flag.Parse()
|
||||||
|
|
||||||
// start server
|
// start server
|
||||||
|
|||||||
Reference in New Issue
Block a user