mirror of
https://github.com/idanoo/autobrr
synced 2025-07-22 16:29:12 +00:00
build(docker): add multiarch build for ARM, ARM64 and AMD64 (#378)
* Update Docker workflow add buildx and qemu to support mulitarch builds configure arm, arm64 and amd64 builds * Change yarn timeout fixes issue with yarn install timing out * chore: update gitignore * chore: add gitignore for web dir * chore(web): upgrade to yarn2 * build: update actions and push docker hub * build: add yarnrc and network-timeout * build: unifi workflow * build: depend on web to build first * build: store artifacts between jobs * build: store artifacts between jobs * build: store artifacts between jobs * build: store artifacts between jobs * build: adjust dockerignore * build: conditional extract metadata * build: conditional extract metadata * build: always push docker hub * build: skip docker hub for now * build: fix metadata
This commit is contained in:
parent
98ae6da6ca
commit
22829b194f
11 changed files with 14564 additions and 9459 deletions
|
@ -1,10 +1,17 @@
|
|||
node_modules/
|
||||
.run
|
||||
.gitignore
|
||||
.github
|
||||
.dev
|
||||
config.toml
|
||||
.goreleaser.yml
|
||||
Dockerfile
|
||||
Dockerfile.ci
|
||||
docker-compose.yml
|
||||
README.md
|
||||
bin
|
||||
config
|
||||
web/node_modules
|
||||
web/build
|
||||
test
|
||||
web/*
|
||||
!web/build*
|
||||
#!web/build.go
|
||||
|
|
53
.github/workflows/docker.yml
vendored
53
.github/workflows/docker.yml
vendored
|
@ -1,53 +0,0 @@
|
|||
name: docker
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "master"
|
||||
- "develop"
|
||||
tags:
|
||||
- 'v*'
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
packages: write
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
name: Build and publish Docker images
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v3
|
||||
with:
|
||||
images: ghcr.io/autobrr/autobrr
|
||||
|
||||
- name: Build and publish image
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: |
|
||||
BUILDTIME=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
|
||||
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 }}
|
161
.github/workflows/release.yml
vendored
161
.github/workflows/release.yml
vendored
|
@ -1,43 +1,109 @@
|
|||
name: goreleaser
|
||||
name: build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "master"
|
||||
- "develop"
|
||||
tags:
|
||||
- '*'
|
||||
- 'v*'
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
|
||||
jobs:
|
||||
goreleaser:
|
||||
name: Build and publish Go binaries
|
||||
web:
|
||||
name: Build web
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
-
|
||||
name: Set up Node
|
||||
uses: actions/setup-node@v2
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '16'
|
||||
-
|
||||
name: Build web
|
||||
node-version: 18
|
||||
cache: 'yarn'
|
||||
cache-dependency-path: web/yarn.lock
|
||||
|
||||
- name: Build web
|
||||
run: |
|
||||
cd web && yarn install
|
||||
CI= yarn build
|
||||
-
|
||||
name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
|
||||
- name: Upload web production build
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
go-version: 1.18.3
|
||||
-
|
||||
name: Run GoReleaser
|
||||
name: web-build
|
||||
path: web/build
|
||||
|
||||
goreleaserbuild:
|
||||
name: Build Go binaries
|
||||
if: github.event_name == 'pull_request'
|
||||
runs-on: ubuntu-latest
|
||||
needs: web
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download web production build
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: web-build
|
||||
path: web/build
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: '1.18.5'
|
||||
cache: true
|
||||
|
||||
- name: Run GoReleaser build
|
||||
uses: goreleaser/goreleaser-action@v2
|
||||
with:
|
||||
distribution: goreleaser
|
||||
version: latest
|
||||
args: release --rm-dist --skip-publish
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Upload assets
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: autobrr
|
||||
path: dist/*
|
||||
|
||||
goreleaser:
|
||||
name: Build and publish Go binaries
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
runs-on: ubuntu-latest
|
||||
needs: web
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download web production build
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: web-build
|
||||
path: web/build
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: '1.18.5'
|
||||
cache: true
|
||||
|
||||
- name: Run GoReleaser build and publish tags
|
||||
uses: goreleaser/goreleaser-action@v3
|
||||
with:
|
||||
distribution: goreleaser
|
||||
version: latest
|
||||
|
@ -49,4 +115,57 @@ jobs:
|
|||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: autobrr
|
||||
path: dist/*
|
||||
path: dist/*
|
||||
|
||||
docker:
|
||||
name: Build and publish Docker images
|
||||
runs-on: ubuntu-latest
|
||||
needs: web
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download web production build
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: web-build
|
||||
path: web/build
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: ghcr.io/autobrr/autobrr
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Build and publish image
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile.ci
|
||||
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: |
|
||||
BUILDTIME=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
|
||||
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 }}
|
||||
|
|
8
.gitignore
vendored
8
.gitignore
vendored
|
@ -20,7 +20,13 @@ Thumbs.db
|
|||
|
||||
# Other
|
||||
.idea
|
||||
.yarn
|
||||
.pnp.*
|
||||
.yarn/*
|
||||
!.yarn/patches
|
||||
!.yarn/plugins
|
||||
!.yarn/releases
|
||||
!.yarn/sdks
|
||||
!.yarn/versions
|
||||
node_modules/
|
||||
web/build
|
||||
bin/
|
||||
|
|
11
Dockerfile
11
Dockerfile
|
@ -1,8 +1,9 @@
|
|||
# build web
|
||||
FROM node:16-alpine AS web-builder
|
||||
FROM node:18.7.0-alpine3.16 AS web-builder
|
||||
WORKDIR /web
|
||||
COPY web/package.json web/yarn.lock ./
|
||||
RUN yarn install
|
||||
COPY web/package.json web/yarn.lock web/.yarnrc.yml ./
|
||||
COPY web/.yarn/releases/ ./.yarn/releases/
|
||||
RUN yarn install --network-timeout 120000
|
||||
COPY web .
|
||||
RUN yarn build
|
||||
|
||||
|
@ -27,8 +28,8 @@ COPY . ./
|
|||
COPY --from=web-builder /web/build ./web/build
|
||||
COPY --from=web-builder /web/build.go ./web
|
||||
|
||||
ENV GOOS=linux
|
||||
ENV CGO_ENABLED=1
|
||||
#ENV GOOS=linux
|
||||
#ENV CGO_ENABLED=0
|
||||
|
||||
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
|
||||
|
|
44
Dockerfile.ci
Normal file
44
Dockerfile.ci
Normal file
|
@ -0,0 +1,44 @@
|
|||
# build app
|
||||
FROM golang:1.18-alpine3.16 AS app-builder
|
||||
|
||||
ARG VERSION=dev
|
||||
ARG REVISION=dev
|
||||
ARG BUILDTIME
|
||||
|
||||
RUN apk add --no-cache git make build-base
|
||||
|
||||
ENV SERVICE=autobrr
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
COPY . ./
|
||||
|
||||
#ENV GOOS=linux
|
||||
#ENV CGO_ENABLED=0
|
||||
|
||||
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
|
||||
|
||||
# build runner
|
||||
FROM alpine:latest
|
||||
|
||||
LABEL org.opencontainers.image.source = "https://github.com/autobrr/autobrr"
|
||||
|
||||
ENV HOME="/config" \
|
||||
XDG_CONFIG_HOME="/config" \
|
||||
XDG_DATA_HOME="/config"
|
||||
|
||||
RUN apk --no-cache add ca-certificates curl
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
VOLUME /config
|
||||
|
||||
COPY --from=app-builder /src/bin/autobrr /usr/local/bin/
|
||||
COPY --from=app-builder /src/bin/autobrrctl /usr/local/bin/
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/autobrr", "--config", "/config"]
|
||||
#CMD ["--config", "/config"]
|
39
web/.gitignore
vendored
Normal file
39
web/.gitignore
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
# Logs and databases #
|
||||
######################
|
||||
*.log
|
||||
*.sql
|
||||
*.sqlite
|
||||
*.db
|
||||
*.db-shm
|
||||
*.db-wal
|
||||
*.db*
|
||||
|
||||
# OS generated files #
|
||||
######################
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
# Other
|
||||
.idea
|
||||
.pnp.*
|
||||
.yarn/*
|
||||
!.yarn/patches
|
||||
!.yarn/plugins
|
||||
!.yarn/releases
|
||||
!.yarn/sdks
|
||||
!.yarn/versions
|
||||
node_modules/
|
||||
web/build
|
||||
bin/
|
||||
log/
|
||||
dist/
|
||||
# If needed, package-lock.json shall be added
|
||||
# manually using an explicit git add command.
|
||||
package-lock.json
|
||||
# Ditto for yarn, except we're using npm.
|
||||
yarn.lock
|
783
web/.yarn/releases/yarn-3.2.2.cjs
vendored
Executable file
783
web/.yarn/releases/yarn-3.2.2.cjs
vendored
Executable file
File diff suppressed because one or more lines are too long
2
web/.yarnrc.yml
Normal file
2
web/.yarnrc.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
yarnPath: .yarn/releases/yarn-3.2.2.cjs
|
||||
nodeLinker: node-modules
|
|
@ -66,5 +66,6 @@
|
|||
"postcss": "^8.4.14",
|
||||
"tailwindcss": "^3.1.3",
|
||||
"typescript": "^4.7.3"
|
||||
}
|
||||
},
|
||||
"packageManager": "yarn@3.2.2"
|
||||
}
|
||||
|
|
22908
web/yarn.lock
22908
web/yarn.lock
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue