mirror of
https://github.com/idanoo/autobrr
synced 2025-07-22 16:29:12 +00:00

* refactor(dockerfile): optimize Docker builds Combined multiple run commands into single statements in both main and CI dockerfiles, leveraging Docker's caching mechanism more effectively. This change aims to reduce image size and build time. * hmm. * Update ci.Dockerfile * newline * what about this * three quorum members, three opinions * true believer, right? * when needed * it sounds like music * equals what * really though, what? * which one of you is the captain * is that Kwejian whiskey * ARG * ARGH * k. * take me to your leader * asd * Update ci.Dockerfile * try cache * Revert * Run Seperate platforms * docker_build * mother * aggressive elephant * leave me to my bath * introduce buildx cache * czechout manifests * front left paw * kill tags * dealing with a child * Update release.yml * try outputs * consolidation * - = * oxygen depleted * where's the soup * thanks buildx * what's a little avx among friends * Fine, I'll bring my own matches * zenuuuu * space, the final frontier * but why * ARE YOU HAPPY NOW * link those binaries * fast fail * just the time killer you need * add back generic arm * ruthless dictator barbie * kat * build: docker add more labels --------- Co-authored-by: Kyle Sanderson <kyle.leet@gmail.com> Co-authored-by: ze0s <43699394+zze0s@users.noreply.github.com>
49 lines
1.5 KiB
Docker
49 lines
1.5 KiB
Docker
# build app
|
|
FROM --platform=$BUILDPLATFORM golang:1.20-alpine3.19 AS app-builder
|
|
RUN apk add --no-cache git tzdata
|
|
|
|
ENV SERVICE=autobrr
|
|
|
|
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 main.version=${VERSION} -X main.commit=${REVISION} -X main.date=${BUILDTIME}" -o /out/bin/autobrr cmd/autobrr/main.go && \
|
|
go build -ldflags "-s -w -X main.version=${VERSION} -X main.commit=${REVISION} -X main.date=${BUILDTIME}" -o /out/bin/autobrrctl cmd/autobrrctl/main.go
|
|
|
|
# build runner
|
|
FROM alpine:latest AS runner
|
|
|
|
LABEL org.opencontainers.image.source = "https://github.com/autobrr/autobrr"
|
|
LABEL org.opencontainers.image.licenses = "GPL-2.0-or-later"
|
|
LABEL org.opencontainers.image.base.name = "alpine:latest"
|
|
|
|
ENV HOME="/config" \
|
|
XDG_CONFIG_HOME="/config" \
|
|
XDG_DATA_HOME="/config"
|
|
|
|
RUN apk --no-cache add ca-certificates curl tzdata jq
|
|
|
|
WORKDIR /app
|
|
VOLUME /config
|
|
EXPOSE 7474
|
|
|
|
COPY --link --from=app-builder /out/bin/autobrr* /usr/local/bin/
|
|
|
|
ENTRYPOINT ["/usr/local/bin/autobrr", "--config", "/config"]
|