mirror of
https://github.com/idanoo/autobrr
synced 2025-07-22 16:29:12 +00:00
build: make ci 2-3x faster (#859)
* Create scratch.Dockerfile * "best practices" * even faster? * too fast. change outdir * flip to 1.20.3 + v4 + setup go on docker * download deps * debug * Update ci.Dockerfile * Update goreleaser.Dockerfile * enable web caching * Update release.yml * Update ci.Dockerfile * revert goreleaser * cleanup * set GOCACHE * Update ci.Dockerfile * Delete scratch.Dockerfile
This commit is contained in:
parent
7f05dd1efd
commit
d546288c2a
3 changed files with 24 additions and 28 deletions
14
.github/workflows/release.yml
vendored
14
.github/workflows/release.yml
vendored
|
@ -59,9 +59,9 @@ jobs:
|
|||
|
||||
# 1.20 is the last version to support Windows < 10, Server < 2016, and MacOS < 1.15.
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v3
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: '1.20.1'
|
||||
go-version: '1.20.3'
|
||||
cache: true
|
||||
|
||||
- name: Test
|
||||
|
@ -86,9 +86,9 @@ jobs:
|
|||
|
||||
# 1.20 is the last version to support Windows < 10, Server < 2016, and MacOS < 1.15.
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v3
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: '1.20.1'
|
||||
go-version: '1.20.3'
|
||||
cache: true
|
||||
|
||||
- name: Run GoReleaser build
|
||||
|
@ -125,9 +125,9 @@ jobs:
|
|||
|
||||
# 1.20 is the last version to support Windows < 10, Server < 2016, and MacOS < 1.15.
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v3
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: '1.20.1'
|
||||
go-version: '1.20.3'
|
||||
cache: true
|
||||
|
||||
- name: Run GoReleaser build and publish tags
|
||||
|
@ -195,4 +195,4 @@ jobs:
|
|||
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
|
||||
REVISION=${{ github.event.pull_request.head.sha }}
|
||||
- name: Image digest
|
||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||
|
|
|
@ -1,26 +1,25 @@
|
|||
# build app
|
||||
FROM golang:1.20-alpine3.16 AS app-builder
|
||||
FROM --platform=$BUILDPLATFORM golang:1.20-alpine3.16 AS app-builder
|
||||
|
||||
ARG VERSION=dev
|
||||
ARG REVISION=dev
|
||||
ARG BUILDTIME
|
||||
|
||||
RUN apk add --no-cache git make build-base tzdata
|
||||
RUN apk add --no-cache git tzdata
|
||||
|
||||
ENV SERVICE=autobrr
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
COPY . ./
|
||||
|
||||
#ENV GOOS=linux
|
||||
#ENV CGO_ENABLED=0
|
||||
RUN --mount=target=. \
|
||||
go mod download
|
||||
|
||||
RUN go build -ldflags "-s -w -X main.version=${VERSION} -X main.commit=${REVISION} -X main.date=${BUILDTIME}" -o bin/autobrr cmd/autobrr/main.go
|
||||
RUN go build -ldflags "-s -w -X main.version=${VERSION} -X main.commit=${REVISION} -X main.date=${BUILDTIME}" -o bin/autobrrctl cmd/autobrrctl/main.go
|
||||
ARG VERSION=dev
|
||||
ARG REVISION=dev
|
||||
ARG BUILDTIME
|
||||
ARG TARGETOS TARGETARCH
|
||||
|
||||
RUN --mount=target=. \
|
||||
GOOS=$TARGETOS GOARCH=$TARGETARCH 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
|
||||
RUN --mount=target=. \
|
||||
GOOS=$TARGETOS GOARCH=$TARGETARCH 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
|
||||
|
@ -34,13 +33,9 @@ XDG_DATA_HOME="/config"
|
|||
RUN apk --no-cache add ca-certificates curl tzdata jq
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
VOLUME /config
|
||||
|
||||
COPY --from=app-builder /src/bin/autobrr /usr/local/bin/
|
||||
COPY --from=app-builder /src/bin/autobrrctl /usr/local/bin/
|
||||
|
||||
EXPOSE 7474
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/autobrr", "--config", "/config"]
|
||||
#CMD ["--config", "/config"]
|
||||
|
||||
COPY --from=app-builder /out/bin/autobrr /usr/local/bin/
|
||||
COPY --from=app-builder /out/bin/autobrrctl /usr/local/bin/
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
yarnPath: .yarn/releases/yarn-3.2.2.cjs
|
||||
nodeLinker: node-modules
|
||||
enableGlobalCache: true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue