| gio | 0eaf271 | 2024-04-14 13:08:46 +0400 | [diff] [blame] | 1 | repo_name ?= giolekva |
| 2 | podman ?= docker |
| 3 | ifeq ($(podman), podman) |
| 4 | manifest_dest=docker://docker.io/$(repo_name)/app-runner:golang-1.22.0 |
| 5 | endif |
| 6 | |
| 7 | clean: |
| 8 | rm -f app-runner |
| 9 | |
| 10 | build_arm64: export CGO_ENABLED=0 |
| 11 | build_arm64: export GO111MODULE=on |
| 12 | build_arm64: export GOOS=linux |
| 13 | build_arm64: export GOARCH=arm64 |
| 14 | build_arm64: |
| 15 | /usr/local/go/bin/go build -o app-runner_arm64 *.go |
| 16 | |
| 17 | build_amd64: export CGO_ENABLED=0 |
| 18 | build_amd64: export GO111MODULE=on |
| 19 | build_amd64: export GOOS=linux |
| 20 | build_amd64: export GOARCH=amd64 |
| 21 | build_amd64: |
| 22 | /usr/local/go/bin/go build -o app-runner_amd64 *.go |
| 23 | |
| 24 | push_arm64: clean build_arm64 |
| 25 | $(podman) build --platform linux/arm64 --tag=$(repo_name)/app-runner:golang-1.22.0-arm64 . |
| 26 | $(podman) push $(repo_name)/app-runner:golang-1.22.0-arm64 |
| 27 | |
| 28 | push_amd64: clean build_amd64 |
| 29 | $(podman) build --platform linux/amd64 --tag=$(repo_name)/app-runner:golang-1.22.0-amd64 . |
| 30 | $(podman) push $(repo_name)/app-runner:golang-1.22.0-amd64 |
| 31 | |
| 32 | push: push_arm64 push_amd64 |
| 33 | $(podman) manifest create $(repo_name)/app-runner:golang-1.22.0 $(repo_name)/app-runner:golang-1.22.0-arm64 $(repo_name)/app-runner:golang-1.22.0-amd64 |
| 34 | $(podman) manifest push $(repo_name)/app-runner:golang-1.22.0 $(manifest_dest) |
| 35 | $(podman) manifest rm $(repo_name)/app-runner:golang-1.22.0 |
| gio | 03fd0c7 | 2024-06-18 12:31:42 +0400 | [diff] [blame^] | 36 | |
| 37 | # Hugo |
| 38 | |
| 39 | push_hugo_arm64: clean build_arm64 |
| 40 | $(podman) build --platform linux/arm64 --tag=$(repo_name)/app-runner:hugo-latest-arm64 -f Dockerfile.hugo . |
| 41 | $(podman) push $(repo_name)/app-runner:hugo-latest-arm64 |
| 42 | |
| 43 | push_hugo_amd64: clean build_amd64 |
| 44 | $(podman) build --platform linux/amd64 --tag=$(repo_name)/app-runner:hugo-latest-amd64 -f Dockerfile.hugo . |
| 45 | $(podman) push $(repo_name)/app-runner:hugo-latest-amd64 |
| 46 | |
| 47 | push_hugo: push_hugo_arm64 push_hugo_amd64 |
| 48 | $(podman) manifest create $(repo_name)/app-runner:hugo-latest $(repo_name)/app-runner:hugo-latest-arm64 $(repo_name)/app-runner:hugo-latest-amd64 |
| 49 | $(podman) manifest push $(repo_name)/app-runner:hugo-latest $(manifest_dest) |
| 50 | $(podman) manifest rm $(repo_name)/app-runner:hugo-latest |