-
-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* implement native multi-arch builds * Create ci.Dockerfile * Create .goreleaser.yml * Create goreleaser.Dockerfile --------- Co-authored-by: mgdigital <mgdigital@users.noreply.github.com>
- Loading branch information
1 parent
2fff99d
commit fc3ae58
Showing
4 changed files
with
276 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
before: | ||
hooks: | ||
- go mod tidy | ||
|
||
builds: | ||
- id: bitmagnet | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- windows | ||
- darwin | ||
- freebsd | ||
goarch: | ||
- amd64 | ||
- arm | ||
- arm64 | ||
goarm: | ||
- 6 | ||
ignore: | ||
- goos: windows | ||
goarch: arm | ||
- goos: windows | ||
goarch: arm64 | ||
- goos: darwin | ||
goarch: arm | ||
- goos: freebsd | ||
goarch: arm | ||
- goos: freebsd | ||
goarch: arm64 | ||
main: ./main.go | ||
binary: bitmagnet | ||
|
||
archives: | ||
- id: bitmagnet | ||
builds: | ||
- bitmagnet | ||
format_overrides: | ||
- goos: windows | ||
format: zip | ||
name_template: >- | ||
{{ .ProjectName }}_ | ||
{{- .Version }}_ | ||
{{- .Os }}_ | ||
{{- if eq .Arch "amd64" }}x86_64 | ||
{{- else }}{{ .Arch }}{{ end }} | ||
release: | ||
prerelease: auto | ||
footer: | | ||
**Full Changelog**: https://github.com/bitmagnet-io/bitmagnet/compare/{{ .PreviousTag }}...{{ .Tag }} | ||
## Docker images | ||
- `docker pull ghcr.io/bitmagnet-io/bitmagnet:{{ .Tag }}` | ||
## What to do next? | ||
- Read the [documentation](https://bitmagnet.io) | ||
- Join our [Discord server](https://discord.gg/6mFNszX8qM) | ||
checksum: | ||
name_template: '{{ .ProjectName }}_{{ .Version }}_checksums.txt' | ||
|
||
changelog: | ||
sort: asc | ||
use: github | ||
filters: | ||
exclude: | ||
- Merge pull request | ||
- Merge remote-tracking branch | ||
- Merge branch | ||
groups: | ||
- title: 'New Features' | ||
regexp: "^.*feat[(\\w)]*:+.*$" | ||
order: 0 | ||
- title: 'Bug fixes' | ||
regexp: "^.*fix[(\\w)]*:+.*$" | ||
order: 10 | ||
- title: Other work | ||
order: 999 | ||
|
||
nfpms: | ||
- package_name: bitmagnet | ||
homepage: https://bitmagnet.io | ||
maintainer: bitmagnet <packages@bitmagnet.io> | ||
description: |- | ||
bitmagnet is a self-hosted BitTorrent indexer. | ||
formats: | ||
- apk | ||
- deb | ||
- rpm | ||
- archlinux |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# build app | ||
FROM --platform=$BUILDPLATFORM golang:1.22-alpine3.19 AS app-builder | ||
RUN apk add --no-cache git tzdata | ||
|
||
ENV SERVICE=bitmagnet | ||
|
||
WORKDIR /src | ||
|
||
# Cache Go modules | ||
COPY go.mod go.sum ./ | ||
RUN go mod download | ||
|
||
COPY . ./ | ||
|
||
ARG VERSION=dev | ||
ARG REVISION=dev | ||
ARG BUILDTIME | ||
ARG TARGETOS TARGETARCH TARGETVARIANT | ||
|
||
RUN --network=none --mount=target=. \ | ||
export GOOS=$TARGETOS; \ | ||
export GOARCH=$TARGETARCH; \ | ||
[[ "$GOARCH" == "amd64" ]] && export GOAMD64=$TARGETVARIANT; \ | ||
[[ "$GOARCH" == "arm" ]] && [[ "$TARGETVARIANT" == "v6" ]] && export GOARM=6; \ | ||
[[ "$GOARCH" == "arm" ]] && [[ "$TARGETVARIANT" == "v7" ]] && export GOARM=7; \ | ||
echo $GOARCH $GOOS $GOARM$GOAMD64; \ | ||
go build -ldflags "-s -w -X github.com/bitmagnet-io/bitmagnet/internal/version.GitTag=${VERSION}" -o /build/bitmagnet main.go | ||
|
||
# build runner | ||
FROM alpine:latest AS runner | ||
|
||
LABEL org.opencontainers.image.source = "https://github.com/bitmagnet-io/bitmagnet" | ||
LABEL org.opencontainers.image.licenses = "MIT" | ||
LABEL org.opencontainers.image.base.name = "alpine:latest" | ||
|
||
RUN apk --no-cache add ca-certificates curl tzdata jq iproute2-ss | ||
|
||
COPY --link --from=app-builder /build/bitmagnet* /usr/local/bin/ | ||
|
||
ENTRYPOINT ["/usr/local/bin/bitmagnet"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM alpine:latest | ||
|
||
LABEL org.opencontainers.image.source = "https://github.com/bitmagnet-io/bitmagnet" | ||
RUN ["apk", "--no-cache", "add", "ca-certificates","curl","iproute2-ss"] | ||
|
||
COPY bitmagnet /usr/local/bin/bitmagnet | ||
ENTRYPOINT ["/usr/local/bin/bitmagnet"] |