mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +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
12
.github/workflows/release.yml
vendored
12
.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.
|
# 1.20 is the last version to support Windows < 10, Server < 2016, and MacOS < 1.15.
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: '1.20.1'
|
go-version: '1.20.3'
|
||||||
cache: true
|
cache: true
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
|
@ -86,9 +86,9 @@ jobs:
|
||||||
|
|
||||||
# 1.20 is the last version to support Windows < 10, Server < 2016, and MacOS < 1.15.
|
# 1.20 is the last version to support Windows < 10, Server < 2016, and MacOS < 1.15.
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: '1.20.1'
|
go-version: '1.20.3'
|
||||||
cache: true
|
cache: true
|
||||||
|
|
||||||
- name: Run GoReleaser build
|
- 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.
|
# 1.20 is the last version to support Windows < 10, Server < 2016, and MacOS < 1.15.
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: '1.20.1'
|
go-version: '1.20.3'
|
||||||
cache: true
|
cache: true
|
||||||
|
|
||||||
- name: Run GoReleaser build and publish tags
|
- name: Run GoReleaser build and publish tags
|
||||||
|
|
|
@ -1,26 +1,25 @@
|
||||||
# build app
|
# 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
|
RUN apk add --no-cache git tzdata
|
||||||
ARG REVISION=dev
|
|
||||||
ARG BUILDTIME
|
|
||||||
|
|
||||||
RUN apk add --no-cache git make build-base tzdata
|
|
||||||
|
|
||||||
ENV SERVICE=autobrr
|
ENV SERVICE=autobrr
|
||||||
|
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|
||||||
COPY go.mod go.sum ./
|
|
||||||
RUN go mod download
|
|
||||||
|
|
||||||
COPY . ./
|
COPY . ./
|
||||||
|
|
||||||
#ENV GOOS=linux
|
RUN --mount=target=. \
|
||||||
#ENV CGO_ENABLED=0
|
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
|
ARG VERSION=dev
|
||||||
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 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
|
# build runner
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
|
@ -34,13 +33,9 @@ XDG_DATA_HOME="/config"
|
||||||
RUN apk --no-cache add ca-certificates curl tzdata jq
|
RUN apk --no-cache add ca-certificates curl tzdata jq
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
VOLUME /config
|
VOLUME /config
|
||||||
|
|
||||||
COPY --from=app-builder /src/bin/autobrr /usr/local/bin/
|
|
||||||
COPY --from=app-builder /src/bin/autobrrctl /usr/local/bin/
|
|
||||||
|
|
||||||
EXPOSE 7474
|
EXPOSE 7474
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/local/bin/autobrr", "--config", "/config"]
|
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
|
yarnPath: .yarn/releases/yarn-3.2.2.cjs
|
||||||
nodeLinker: node-modules
|
nodeLinker: node-modules
|
||||||
|
enableGlobalCache: true
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue