Build webserver using ko-build
This commit is contained in:
parent
3fab794c13
commit
ca91974429
@ -8,7 +8,9 @@ The containers are stored on my gitea instance, so you can pull them like this:
|
||||
docker pull gitea.elara.ws/elara6331/golang:latest
|
||||
```
|
||||
|
||||
Some of the images use [ko.build](https://github.com/ko-build/ko)
|
||||
|
||||
### Images
|
||||
|
||||
- `golang`: An alpine-based image with Go installed
|
||||
- `webserver`: A very simple webserver
|
||||
- `webserver`: A very simple webserver
|
||||
|
@ -1,4 +0,0 @@
|
||||
FROM busybox:latest
|
||||
COPY webserver /usr/bin/webserver
|
||||
RUN mkdir /html
|
||||
ENTRYPOINT webserver
|
@ -2,4 +2,6 @@
|
||||
|
||||
The [webserver image](https://gitea.elara.ws/Elara6331/-/packages/container/webserver/latest) is a very simple webserver that serves its `/html` directory and logs requests. It doesn't have any TLS capabilities or anything like that, it just serves some static files and does nothing else.
|
||||
|
||||
You can change the address it listens on using the `WEBSERVER_ADDR` environment variable.
|
||||
You can change the address it listens on using the `WEBSERVER_ADDR` environment variable.
|
||||
|
||||
This image uses [ko.build](https://ko.build)
|
||||
|
@ -1,12 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ $# == 0 ]]; then
|
||||
echo "Usage: $0 <arch>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
GOOS=linux GOARCH=$1 go build -o webserver ./cmd/main.go
|
||||
|
||||
docker login gitea.elara.ws
|
||||
docker build . -t "gitea.elara.ws/elara6331/webserver:$1"
|
||||
docker push "gitea.elara.ws/elara6331/webserver:$1"
|
||||
pushd cmd
|
||||
KO_DOCKER_REPO=gitea.elara.ws/elara6331 ko build -B \
|
||||
--platform=linux/amd64,linux/arm64,linux/riscv64 \
|
||||
--sbom=none
|
||||
popd
|
||||
|
3
webserver/cmd/go.mod
Normal file
3
webserver/cmd/go.mod
Normal file
@ -0,0 +1,3 @@
|
||||
module webserver
|
||||
|
||||
go 1.21.0
|
@ -1,11 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
tag="$1"
|
||||
tag="${tag:=latest}"
|
||||
|
||||
docker login gitea.elara.ws
|
||||
docker manifest create "gitea.elara.ws/elara6331/webserver:$tag" \
|
||||
--amend gitea.elara.ws/elara6331/webserver:amd64 \
|
||||
--amend gitea.elara.ws/elara6331/webserver:arm64 \
|
||||
--amend gitea.elara.ws/elara6331/webserver:riscv64
|
||||
docker manifest push "gitea.elara.ws/elara6331/webserver:$tag"
|
Loading…
Reference in New Issue
Block a user