diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..9bd3f59 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,30 @@ +kind: pipeline +type: docker +name: default +trigger: + event: + - tag + +steps: + - name: Build + image: ghcr.io/abjrcode/cross-wails:v2.6.0 + commands: + - apt-get update + - apt-get install -y upx + - GOOS=linux GOARCH=amd64 CC=x86_64-linux-gnu-gcc wails build -ldflags "-X main.appVersion=$DRONE_TAG" -platform linux/amd64 -upx -o strimertul-amd64 + - GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc wails build -ldflags "-X main.appVersion=$DRONE_TAG" -m -nosyncgomod -skipbindings -s -platform linux/arm64 -upx -o strimertul-arm64 + - GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc wails build -ldflags "-X main.appVersion=$DRONE_TAG" -m -nosyncgomod -skipbindings -s -platform windows/amd64 -upx + + - name: Upload + image: plugins/s3 + settings: + bucket: strimertul-builds + access_key: + from_secret: minio_access + secret_key: + from_secret: minio_secret + source: /drone/src/build/bin/**/* + target: /$DRONE_TAG/ + strip_prefix: /drone/src/build/bin/ + path_style: true + endpoint: https://artifacts.fromouter.space diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..60b2a3c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,37 @@ +ARG BASE_IMAGE=ghcr.io/abjrcode/cross-wails:v2.6.0 + +FROM ${BASE_IMAGE} as builder + +WORKDIR /usr/src/app + +COPY go.mod go.sum ./ + +RUN go mod download + +COPY . . + +# Docker injects the value of BUILDARCH into the build process +ARG BUILDARCH + +# Needed atm due to https://github.com/wailsapp/wails/issues/1921 +RUN set -exo pipefail; \ + if [ "${BUILDARCH}" = "amd64" ]; then \ + GOOS=linux GOARCH=amd64 CC=x86_64-linux-gnu-gcc wails build -platform linux/amd64 -o example-amd64; \ + GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc wails build -skipbindings -s -platform linux/arm64 -o example-arm64; \ + GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc wails build -skipbindings -s -platform windows/amd64; \ + else \ + GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc wails build -platform linux/arm64 -o example-arm64; \ + GOOS=linux GOARCH=amd64 CC=x86_64-linux-gnu-gcc wails build -skipbindings -s -platform linux/amd64 -o example-amd64; \ + GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc wails build -skipbindings -s -platform windows/amd64; \ + fi; + +ENTRYPOINT [ "/bin/bash" ] + +############################################################# + +FROM ${BASE_IMAGE} + +COPY --from=builder /usr/src/app/build/bin /out + +ENTRYPOINT [ "sh", "-c" ] +CMD [ "cp -r /out/. /artifacts/" ] \ No newline at end of file