mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
build(docker): add Windows images (#1640)
* feat(docker): add Windows images * Create ciwindows.Dockerfile * freddy? * no it's camel * have as many words with him as you like * better go get more men * an eye for an arm, ricky * mcr.microsoft.com/windows/nanoserver:ltsc2022 * make a dime an hour for the company man --------- Co-authored-by: ze0s <43699394+zze0s@users.noreply.github.com>
This commit is contained in:
parent
cf2da14073
commit
46b3ae8a0f
2 changed files with 51 additions and 1 deletions
3
.github/workflows/release.yml
vendored
3
.github/workflows/release.yml
vendored
|
@ -166,6 +166,7 @@ jobs:
|
||||||
- linux/ppc64le
|
- linux/ppc64le
|
||||||
# - linux/riscv64
|
# - linux/riscv64
|
||||||
- linux/s390x
|
- linux/s390x
|
||||||
|
- windows/amd64
|
||||||
needs: [web, test]
|
needs: [web, test]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
@ -213,7 +214,7 @@ jobs:
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./ci.Dockerfile
|
file: ${{ startsWith(matrix.platform, 'windows') && './ciwindows.Dockerfile' || './ci.Dockerfile' }}
|
||||||
platforms: ${{ matrix.platform }}
|
platforms: ${{ matrix.platform }}
|
||||||
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=${{ (github.event.pull_request.head.repo.full_name == github.repository || github.event_name != 'pull_request') && 'true' || 'false' }}
|
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=${{ (github.event.pull_request.head.repo.full_name == github.repository || github.event_name != 'pull_request') && 'true' || 'false' }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|
49
ciwindows.Dockerfile
Normal file
49
ciwindows.Dockerfile
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
# build app
|
||||||
|
FROM --platform=$BUILDPLATFORM golang:1.23-alpine3.20 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
|
||||||
|
ARG TARGETARCH
|
||||||
|
ARG 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 mcr.microsoft.com/windows/nanoserver:ltsc2022 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="mcr.microsoft.com/windows/nanoserver:ltsc2022"
|
||||||
|
|
||||||
|
ENV HOME="/config" \
|
||||||
|
XDG_CONFIG_HOME="/config" \
|
||||||
|
XDG_DATA_HOME="/config"
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
VOLUME /config
|
||||||
|
EXPOSE 7474
|
||||||
|
|
||||||
|
COPY --link --from=app-builder /out/bin/autobrr* /
|
||||||
|
|
||||||
|
ENTRYPOINT ["/autobrr", "--config", "/config"]
|
Loading…
Add table
Add a link
Reference in a new issue