| gio | 0eaf271 | 2024-04-14 13:08:46 +0400 | [diff] [blame] | 1 | repo_name ?= giolekva |
| 2 | podman ?= docker |
| 3 | ifeq ($(podman), podman) |
| gio | d8ab4f5 | 2024-07-26 16:58:34 +0400 | [diff] [blame^] | 4 | manifest_dest_golang_1_22_0=docker://docker.io/$(repo_name)/app-runner:golang-1.22.0 |
| 5 | manifest_dest_golang_1_20_0=docker://docker.io/$(repo_name)/app-runner:golang-1.20.0 |
| 6 | manifest_dest_hugo_latest=docker://docker.io/$(repo_name)/app-runner:hugo-latest |
| gio | 0eaf271 | 2024-04-14 13:08:46 +0400 | [diff] [blame] | 7 | endif |
| 8 | |
| 9 | clean: |
| 10 | rm -f app-runner |
| 11 | |
| 12 | build_arm64: export CGO_ENABLED=0 |
| 13 | build_arm64: export GO111MODULE=on |
| 14 | build_arm64: export GOOS=linux |
| 15 | build_arm64: export GOARCH=arm64 |
| 16 | build_arm64: |
| 17 | /usr/local/go/bin/go build -o app-runner_arm64 *.go |
| 18 | |
| 19 | build_amd64: export CGO_ENABLED=0 |
| 20 | build_amd64: export GO111MODULE=on |
| 21 | build_amd64: export GOOS=linux |
| 22 | build_amd64: export GOARCH=amd64 |
| 23 | build_amd64: |
| 24 | /usr/local/go/bin/go build -o app-runner_amd64 *.go |
| 25 | |
| gio | d8ab4f5 | 2024-07-26 16:58:34 +0400 | [diff] [blame^] | 26 | # Golang 1.22.0 |
| 27 | |
| 28 | push_golang_1_22_0_arm64: clean build_arm64 |
| 29 | $(podman) build --platform linux/arm64 --tag=$(repo_name)/app-runner:golang-1.22.0-arm64 -f Dockerfile.golang.1.22.0 . |
| gio | 0eaf271 | 2024-04-14 13:08:46 +0400 | [diff] [blame] | 30 | $(podman) push $(repo_name)/app-runner:golang-1.22.0-arm64 |
| 31 | |
| gio | d8ab4f5 | 2024-07-26 16:58:34 +0400 | [diff] [blame^] | 32 | push_golang_1_22_0_amd64: clean build_amd64 |
| 33 | $(podman) build --platform linux/amd64 --tag=$(repo_name)/app-runner:golang-1.22.0-amd64 -f Dockerfile.golang.1.22.0 . |
| gio | 0eaf271 | 2024-04-14 13:08:46 +0400 | [diff] [blame] | 34 | $(podman) push $(repo_name)/app-runner:golang-1.22.0-amd64 |
| 35 | |
| gio | d8ab4f5 | 2024-07-26 16:58:34 +0400 | [diff] [blame^] | 36 | push_golang_1_22_0: push_golang_1_22_0_arm64 push_golang_1_22_0_amd64 |
| gio | 0eaf271 | 2024-04-14 13:08:46 +0400 | [diff] [blame] | 37 | $(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 |
| gio | d8ab4f5 | 2024-07-26 16:58:34 +0400 | [diff] [blame^] | 38 | $(podman) manifest push $(repo_name)/app-runner:golang-1.22.0 $(manifest_dest_golang_1_22_0) |
| gio | 0eaf271 | 2024-04-14 13:08:46 +0400 | [diff] [blame] | 39 | $(podman) manifest rm $(repo_name)/app-runner:golang-1.22.0 |
| gio | 03fd0c7 | 2024-06-18 12:31:42 +0400 | [diff] [blame] | 40 | |
| gio | d8ab4f5 | 2024-07-26 16:58:34 +0400 | [diff] [blame^] | 41 | # Golang 1.20.0 |
| 42 | |
| 43 | push_golang_1_20_0_arm64: clean build_arm64 |
| 44 | $(podman) build --platform linux/arm64 --tag=$(repo_name)/app-runner:golang-1.20.0-arm64 -f Dockerfile.golang.1.20.0 . |
| 45 | $(podman) push $(repo_name)/app-runner:golang-1.20.0-arm64 |
| 46 | |
| 47 | push_golang_1_20_0_amd64: clean build_amd64 |
| 48 | $(podman) build --platform linux/amd64 --tag=$(repo_name)/app-runner:golang-1.20.0-amd64 -f Dockerfile.golang.1.20.0 . |
| 49 | $(podman) push $(repo_name)/app-runner:golang-1.20.0-amd64 |
| 50 | |
| 51 | push_golang_1_20_0: push_golang_1_20_0_arm64 push_golang_1_20_0_amd64 |
| 52 | $(podman) manifest create $(repo_name)/app-runner:golang-1.20.0 $(repo_name)/app-runner:golang-1.20.0-arm64 $(repo_name)/app-runner:golang-1.20.0-amd64 |
| 53 | $(podman) manifest push $(repo_name)/app-runner:golang-1.20.0 $(manifest_dest_golang_1_20_0) |
| 54 | $(podman) manifest rm $(repo_name)/app-runner:golang-1.20.0 |
| 55 | |
| gio | 03fd0c7 | 2024-06-18 12:31:42 +0400 | [diff] [blame] | 56 | # Hugo |
| 57 | |
| 58 | push_hugo_arm64: clean build_arm64 |
| 59 | $(podman) build --platform linux/arm64 --tag=$(repo_name)/app-runner:hugo-latest-arm64 -f Dockerfile.hugo . |
| 60 | $(podman) push $(repo_name)/app-runner:hugo-latest-arm64 |
| 61 | |
| 62 | push_hugo_amd64: clean build_amd64 |
| 63 | $(podman) build --platform linux/amd64 --tag=$(repo_name)/app-runner:hugo-latest-amd64 -f Dockerfile.hugo . |
| 64 | $(podman) push $(repo_name)/app-runner:hugo-latest-amd64 |
| 65 | |
| 66 | push_hugo: push_hugo_arm64 push_hugo_amd64 |
| 67 | $(podman) manifest create $(repo_name)/app-runner:hugo-latest $(repo_name)/app-runner:hugo-latest-arm64 $(repo_name)/app-runner:hugo-latest-amd64 |
| gio | d8ab4f5 | 2024-07-26 16:58:34 +0400 | [diff] [blame^] | 68 | $(podman) manifest push $(repo_name)/app-runner:hugo-latest $(manifest_dest_hugo_latest) |
| gio | 03fd0c7 | 2024-06-18 12:31:42 +0400 | [diff] [blame] | 69 | $(podman) manifest rm $(repo_name)/app-runner:hugo-latest |
| gio | d8ab4f5 | 2024-07-26 16:58:34 +0400 | [diff] [blame^] | 70 | |
| 71 | # all |
| 72 | push: push_golang_1_22_0 push_golang_1_20_0 push_hugo |