From 40fcff34b63025a342b7e8c9e6a2d5627c0e8f55 Mon Sep 17 00:00:00 2001 From: Stefan Hoffmann Date: Sat, 2 Jan 2021 19:04:11 +0100 Subject: [PATCH] CI and Dockerfile updated --- .drone.yml | 32 +++++++++++++++++++++++++++----- Dockerfile | 2 +- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/.drone.yml b/.drone.yml index 9c1cc70..5d4bffc 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,12 +1,34 @@ kind: pipeline -name: build-ffmap-ubnt-api - +type: docker +name: build go steps: - - name: build go + - name: build linux/amd64 image: golang commands: - - go build . + - go build -ldflags "-X main.version=${DRONE_TAG}" -o release/linux/amd64/ubnt-freifunk-map-api . + - tar -cvzf release/ubnt-freifunk-map-api_linux_amd64.tar.gz -C release/linux/amd64 ubnt-freifunk-map-api + environment: + GOARCH: amd64 + GOOS: linux + + - name: build linux/arm64 + image: golang + commands: + - go build -ldflags "-X main.version=${DRONE_TAG}" -o release/linux/arm64/ubnt-freifunk-map-api . + - tar -cvzf release/ubnt-freifunk-map-api_linux_arm64.tar.gz -C release/linux/arm64 ubnt-freifunk-map-api + environment: + GOARCH: arm64 + GOOS: linux + + - name: build windows + image: golang + commands: + - go build -ldflags "-X main.version=${DRONE_TAG}" -o release/windows/amd64/ubnt-freifunk-map-api . + - tar -cvzf release/ubnt-freifunk-map-api_windows_amd64.tar.gz -C release/windows/amd64 ubnt-freifunk-map-api + environment: + GOARCH: amd64 + GOOS: windows - name: docker image: plugins/docker @@ -26,7 +48,7 @@ steps: from_secret: gitea_api_key base_url: https://git.freifunk-rhein-sieg.net files: - - ubnt-freifunk-map-api + - release/*.tar.gz title: ${DRONE_TAG} checksum: - md5 diff --git a/Dockerfile b/Dockerfile index 7ecc348..97b29b1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM alpine:latest WORKDIR /opt/ -ADD ./ubnt-freifunk-map-api /opt/ubnt-freifunk-map-api +ADD ./release/linux/arm64/ubnt-freifunk-map-api /opt/ubnt-freifunk-map-api ADD ./devices.json /opt/devices.json RUN chmod +x /opt/ubnt-freifunk-map-api