-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.ci
47 lines (34 loc) · 1.36 KB
/
Dockerfile.ci
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# build app
FROM --platform=$BUILDPLATFORM golang:1.23.1-alpine3.19 AS app-builder
RUN apk add --no-cache git tzdata
ENV SERVICE=distribrr
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/autobrr/distribrr/pkg/version.Version=${VERSION} -X github.com/autobrr/distribrr/pkg/version.Commit=${REVISION} -X github.com/autobrr/distribrr/pkg/version.BuildDate=${BUILDTIME}" -o /out/bin/distribrr cmd/distribrr/main.go
# build runner
FROM alpine:latest AS runner
LABEL org.opencontainers.image.source="https://github.com/autobrr/distribrr"
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/distribrr* /usr/local/bin/
ENTRYPOINT ["/usr/local/bin/distribrr"]