Skip to content

Commit

Permalink
Merge pull request #8 from OldTyT/feature/build_arm
Browse files Browse the repository at this point in the history
Added build arm docker image
  • Loading branch information
OldTyT authored Feb 9, 2024
2 parents 6c71ddb + ba2cf40 commit 3b6eb76
Show file tree
Hide file tree
Showing 6 changed files with 147 additions and 7 deletions.
92 changes: 89 additions & 3 deletions .github/workflows/github-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ on:


jobs:
build:
name: Build & Push
build_amd64:
name: "[amd64] Build & Push"
runs-on: ubuntu-latest
env:
REPOSITORY_URL: ghcr.io
Expand All @@ -25,7 +25,9 @@ jobs:
run: >-
docker build
-t $IMAGE_NAME
-t $REPOSITORY_URL/$IMAGE_NAME:latest .
-t $REPOSITORY_URL/$IMAGE_NAME:amd64-${{ steps.vars.outputs.SHORT_COMMIT_ID }}
-t $REPOSITORY_URL/$IMAGE_NAME:latest
-f docker/amd64/Dockerfile .
- name: Docker Login
uses: docker/login-action@v3
with:
Expand All @@ -35,3 +37,87 @@ jobs:
- name: Publish Image
id: docker-push
run: docker push --all-tags $REPOSITORY_URL/$IMAGE_NAME
build_arm32v6:
name: "[arm32v6] Build & Push"
runs-on: ubuntu-latest
env:
REPOSITORY_URL: ghcr.io
IMAGE_NAME: oldtyt/frigate-telegram
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Variables
id: vars
run: echo "::set-output name=SHORT_COMMIT_ID::$(git rev-parse --short HEAD)"
- name: Set arm32v6 platform
run: docker buildx create --platform linux/arm/v6 --name arm --use
- name: Docker Login
uses: docker/login-action@v3
with:
registry: ${{ env.REPOSITORY_URL }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image
id: docker-build
run: >-
docker buildx build
--platform linux/arm/v6
-t $REPOSITORY_URL/$IMAGE_NAME:arm32v6-${{ steps.vars.outputs.SHORT_COMMIT_ID }}
-t $REPOSITORY_URL/$IMAGE_NAME:arm32v6
-f docker/arm32v6/Dockerfile --push .
build_arm32v7:
name: "[arm32v7] Build & Push"
runs-on: ubuntu-latest
env:
REPOSITORY_URL: ghcr.io
IMAGE_NAME: oldtyt/frigate-telegram
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Variables
id: vars
run: echo "::set-output name=SHORT_COMMIT_ID::$(git rev-parse --short HEAD)"
- name: Set arm32v7 platform
run: docker buildx create --platform linux/arm/v7 --name arm --use
- name: Docker Login
uses: docker/login-action@v3
with:
registry: ${{ env.REPOSITORY_URL }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image
id: docker-build
run: >-
docker buildx build
--platform linux/arm/v7
-t $REPOSITORY_URL/$IMAGE_NAME:arm32v7-${{ steps.vars.outputs.SHORT_COMMIT_ID }}
-t $REPOSITORY_URL/$IMAGE_NAME:arm32v7
-f docker/arm32v7/Dockerfile --push .
build_arm64v8:
name: "[arm64v8] Build & Push"
runs-on: ubuntu-latest
env:
REPOSITORY_URL: ghcr.io
IMAGE_NAME: oldtyt/frigate-telegram
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Variables
id: vars
run: echo "::set-output name=SHORT_COMMIT_ID::$(git rev-parse --short HEAD)"
- name: Set arm64v8 platform
run: docker buildx create --platform linux/arm64/v8 --name arm --use
- name: Docker Login
uses: docker/login-action@v3
with:
registry: ${{ env.REPOSITORY_URL }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image
id: docker-build
run: >-
docker buildx build
--platform linux/arm64/v8
-t $REPOSITORY_URL/$IMAGE_NAME:arm64v8-${{ steps.vars.outputs.SHORT_COMMIT_ID }}
-t $REPOSITORY_URL/$IMAGE_NAME:arm64v8
-f docker/arm64v8/Dockerfile --push .
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ services:
- /data:/mnt/docker/redis/data

frigate-telegram:
image: ghcr.io/oldtyt/frigate-telegram
image: ghcr.io/oldtyt/frigate-telegram:amd64
restart: always
networks: [net]
environment:
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile → docker/amd64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ FROM golang:1.21.3-alpine3.18 AS builder
WORKDIR $GOPATH/frigate-telegram
COPY . $GOPATH/frigate-telegram

RUN apk --no-cache add binutils
RUN go build .
RUN strip frigate-telegram
RUN apk --no-cache add binutils && \
go build . && \
strip frigate-telegram

FROM alpine:3.18

Expand Down
18 changes: 18 additions & 0 deletions docker/arm32v6/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM arm32v6/golang:1.21.3-alpine3.18 AS builder

WORKDIR $GOPATH/frigate-telegram
COPY . $GOPATH/frigate-telegram

RUN apk --no-cache add binutils && \
go build . && \
strip frigate-telegram

FROM arm32v6/alpine:3.18

RUN apk --no-cache add tzdata

COPY --from=builder /go/frigate-telegram/frigate-telegram /frigate-telegram

USER 1000

ENTRYPOINT ["/frigate-telegram"]
18 changes: 18 additions & 0 deletions docker/arm32v7/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM arm32v7/golang:1.21.3-alpine3.18 AS builder

WORKDIR $GOPATH/frigate-telegram
COPY . $GOPATH/frigate-telegram

RUN apk --no-cache add binutils && \
go build . && \
strip frigate-telegram

FROM arm32v7/alpine:3.18

RUN apk --no-cache add tzdata

COPY --from=builder /go/frigate-telegram/frigate-telegram /frigate-telegram

USER 1000

ENTRYPOINT ["/frigate-telegram"]
18 changes: 18 additions & 0 deletions docker/arm64v8/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM arm64v8/golang:1.21.3-alpine3.18 AS builder

WORKDIR $GOPATH/frigate-telegram
COPY . $GOPATH/frigate-telegram

RUN apk --no-cache add binutils && \
go build . && \
strip frigate-telegram

FROM arm64v8/alpine:3.18

RUN apk --no-cache add tzdata

COPY --from=builder /go/frigate-telegram/frigate-telegram /frigate-telegram

USER 1000

ENTRYPOINT ["/frigate-telegram"]

0 comments on commit 3b6eb76

Please sign in to comment.