aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHimbeerserverDE <himbeerserverde@gmail.com>2024-01-20 11:10:41 +0100
committerHimbeerserverDE <himbeerserverde@gmail.com>2024-01-20 11:10:41 +0100
commita7a2bf16e2910854c02b24b2fde4f15a91207c76 (patch)
tree44e32d90edb196db647599cd34dd5f48deea32d6
parentd2580f0a3815c5d5ec452fceac3b2cd34c7d57c0 (diff)
ensure CI builds the latest commit
The Go proxy is highly unlikely to be up to date already when a commit is pushed.
-rw-r--r--Dockerfile6
-rw-r--r--doc/docker.md10
2 files changed, 9 insertions, 7 deletions
diff --git a/Dockerfile b/Dockerfile
index 44edb5f..62ac15e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,12 +1,14 @@
FROM --platform=${BUILDPLATFORM} golang:1.21.4
-ARG version=latest
+ARG VERSION
ARG BUILDPLATFORM
ARG BUILDARCH
ARG TARGETARCH
+COPY . /go/src/github.com/HimbeerserverDE/mt-multiserver-proxy
+
RUN mkdir /usr/local/mt-multiserver-proxy
-RUN GOARCH=${TARGETARCH} go install github.com/HimbeerserverDE/mt-multiserver-proxy/cmd/...@${version}
+RUN GOARCH=${TARGETARCH} go install github.com/HimbeerserverDE/mt-multiserver-proxy/cmd/...@${VERSION:-`(cd /go/src/github.com/HimbeerserverDE/mt-multiserver-proxy && TZ=UTC git --no-pager show --quiet --abbrev=12 --date='format-local:%Y%m%d%H%M%S' --format='v0.0.0-%cd-%h')`}
RUN if [ "${TARGETARCH}" = "${BUILDARCH}" ]; then mv /go/bin/mt-* /usr/local/mt-multiserver-proxy/; else mv /go/bin/linux_${TARGETARCH}/mt-* /usr/local/mt-multiserver-proxy/; fi
VOLUME ["/usr/local/mt-multiserver-proxy"]
diff --git a/doc/docker.md b/doc/docker.md
index 6af77c5..9ff9c38 100644
--- a/doc/docker.md
+++ b/doc/docker.md
@@ -1,8 +1,7 @@
# Docker
This repository contains a `Dockerfile` at its root.
-It can be used to build the most recent release version
-or a development version into an image.
+It can be used to build a release or development version into an image.
## Build
@@ -15,14 +14,14 @@ The images are intended to be built by the default buildx builder.
### Regular
-To build an image of the latest commit, run the following command
+To build an image of the current commit, run the following command
from the repository root:
```
docker buildx build -t mt-multiserver-proxy --load .
```
-This is the version most people will want.
+This works well with CI because it doesn't rely on the Go proxy being up-to-date.
It is also possible to build a specific version into an image:
@@ -30,7 +29,8 @@ It is also possible to build a specific version into an image:
docker buildx build -t mt-multiserver-proxy --load --build-arg version=VERSION .
```
-where `VERSION` is a Go pseudo-version.
+where `VERSION` is a Go pseudo-version or `latest` for the latest version
+known by the Go proxy.
### Development