| Giorgi Lekveishvili | 0ba5e40 | 2024-03-20 15:56:30 +0400 | [diff] [blame] | 1 | repo_name ?= giolekva |
| 2 | podman ?= docker |
| 3 | ifeq ($(podman), podman) |
| 4 | manifest_dest=docker://docker.io/$(repo_name)/pcloud-installer:latest |
| 5 | endif |
| 6 | |
| 7 | clean: |
| 8 | rm -f server server_* |
| 9 | |
| 10 | build: clean |
| Giorgi Lekveishvili | a09fad7 | 2024-03-21 15:24:35 +0400 | [diff] [blame] | 11 | /usr/local/go/bin/go build -o server *.go |
| Giorgi Lekveishvili | 0ba5e40 | 2024-03-20 15:56:30 +0400 | [diff] [blame] | 12 | |
| 13 | build_arm64: export CGO_ENABLED=0 |
| 14 | build_arm64: export GO111MODULE=on |
| 15 | build_arm64: export GOOS=linux |
| 16 | build_arm64: export GOARCH=arm64 |
| 17 | build_arm64: |
| Giorgi Lekveishvili | a09fad7 | 2024-03-21 15:24:35 +0400 | [diff] [blame] | 18 | /usr/local/go/bin/go build -o server_arm64 *.go |
| Giorgi Lekveishvili | 0ba5e40 | 2024-03-20 15:56:30 +0400 | [diff] [blame] | 19 | |
| 20 | build_amd64: export CGO_ENABLED=0 |
| 21 | build_amd64: export GO111MODULE=on |
| 22 | build_amd64: export GOOS=linux |
| 23 | build_amd64: export GOARCH=amd64 |
| 24 | build_amd64: |
| Giorgi Lekveishvili | a09fad7 | 2024-03-21 15:24:35 +0400 | [diff] [blame] | 25 | /usr/local/go/bin/go build -o server_amd64 *.go |
| Giorgi Lekveishvili | 0ba5e40 | 2024-03-20 15:56:30 +0400 | [diff] [blame] | 26 | |
| 27 | push_arm64: clean build_arm64 |
| 28 | $(podman) build --platform linux/arm64 --tag=$(repo_name)/auth-proxy:arm64 . |
| 29 | $(podman) push $(repo_name)/auth-proxy:arm64 |
| 30 | |
| 31 | push_amd64: clean build_amd64 |
| 32 | $(podman) build --platform linux/amd64 --tag=$(repo_name)/auth-proxy:amd64 . |
| 33 | $(podman) push $(repo_name)/auth-proxy:amd64 |
| 34 | |
| 35 | |
| 36 | push: push_arm64 push_amd64 |
| 37 | $(podman) manifest create $(repo_name)/auth-proxy:latest $(repo_name)/auth-proxy:arm64 $(repo_name)/auth-proxy:amd64 |
| 38 | $(podman) manifest push $(repo_name)/auth-proxy:latest $(manifest_dest) |
| 39 | $(podman) manifest rm $(repo_name)/auth-proxy:latest |