Build webserver using ko-build
This commit is contained in:
parent
3fab794c13
commit
ca91974429
@ -8,6 +8,8 @@ The containers are stored on my gitea instance, so you can pull them like this:
|
|||||||
docker pull gitea.elara.ws/elara6331/golang:latest
|
docker pull gitea.elara.ws/elara6331/golang:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Some of the images use [ko.build](https://github.com/ko-build/ko)
|
||||||
|
|
||||||
### Images
|
### Images
|
||||||
|
|
||||||
- `golang`: An alpine-based image with Go installed
|
- `golang`: An alpine-based image with Go installed
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
FROM busybox:latest
|
|
||||||
COPY webserver /usr/bin/webserver
|
|
||||||
RUN mkdir /html
|
|
||||||
ENTRYPOINT webserver
|
|
@ -3,3 +3,5 @@
|
|||||||
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.
|
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
|
#!/bin/bash
|
||||||
|
|
||||||
if [[ $# == 0 ]]; then
|
pushd cmd
|
||||||
echo "Usage: $0 <arch>"
|
KO_DOCKER_REPO=gitea.elara.ws/elara6331 ko build -B \
|
||||||
exit 1
|
--platform=linux/amd64,linux/arm64,linux/riscv64 \
|
||||||
fi
|
--sbom=none
|
||||||
|
popd
|
||||||
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"
|
|
||||||
|
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