-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathci.Dockerfile
More file actions
51 lines (40 loc) · 1.46 KB
/
ci.Dockerfile
File metadata and controls
51 lines (40 loc) · 1.46 KB
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
48
49
50
51
# build base
FROM --platform=$BUILDPLATFORM golang:1.26-alpine3.23 AS app-base
WORKDIR /src
ENV SERVICE=mangarr
ARG VERSION=dev \
REVISION=dev \
BUILDTIME \
TARGETOS TARGETARCH TARGETVARIANT
COPY go.mod go.sum ./
RUN go mod download
COPY . ./
# build mangarr
FROM --platform=$BUILDPLATFORM app-base AS mangarr
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 mangarr/internal/buildinfo.Version=${VERSION} \
-X mangarr/internal/buildinfo.Commit=${REVISION} \
-X mangarr/internal/buildinfo.Date=${BUILDTIME}" \
-o /out/bin/mangarr main.go
# build runner
FROM alpine:latest AS runner
RUN apk add --no-cache ca-certificates curl tzdata jq tini
LABEL org.opencontainers.image.source="https://github.com/nuxencs/mangarr" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.base.name="alpine:latest"
ENV HOME="/config" \
XDG_CONFIG_HOME="/config" \
XDG_DATA_HOME="/config"
COPY --link --from=mangarr /out/bin/mangarr /usr/bin/
USER nobody:nogroup
WORKDIR /config
VOLUME ["/config"]
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/usr/bin/mangarr", "monitor", "--config", "/config"]