Skip to content

Commit

Permalink
build(docker): Use stock Alpine image (PR: #31)
Browse files Browse the repository at this point in the history
* build(docker): use stock Alpine image

* fix(ci): add step to build docker image

* fix(ci): add `intel-media-driver` only for linux/amd64 platform

* fix(ci): minor step name change
  • Loading branch information
duncanleo authored Apr 25, 2024
1 parent 27d0570 commit 7480398
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 3 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,50 @@ jobs:
GOOS=windows GOARCH=386 go build -v -o ${GITHUB_REPOSITORY##*/}-windows-i386.exe ./cmd/...
GOOS=windows GOARCH=arm go build -v -o ${GITHUB_REPOSITORY##*/}-windows-arm.exe ./cmd/...
GOOS=windows GOARCH=arm64 go build -v -o ${GITHUB_REPOSITORY##*/}-windows-arm64.exe ./cmd/...
build-docker:
name: Build Image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/duncanleo/plex-dvr-hls
flavor: |
latest=false
tags: |
type=raw,priority=1000,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build without Pushing
id: docker_build
uses: docker/build-push-action@v5
with:
context: .
pull: true
push: false
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

11 changes: 8 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21-alpine as app-build
FROM golang:1.21-alpine3.19 as app-build

WORKDIR /app
COPY go.mod .
Expand All @@ -10,9 +10,14 @@ COPY . .

RUN go build -o /bin/app cmd/*.go

FROM collelog/ffmpeg:4.4-alpine-vaapi-amd64
FROM alpine:3.19

RUN apk add ffmpeg
ARG TARGETPLATFORM

RUN case ${TARGETPLATFORM:-linux/amd64} in \
"linux/amd64") apk add ffmpeg intel-media-driver ;; \
*) apk add ffmpeg ;; \
esac

COPY --from=app-build /bin/app /bin/app
WORKDIR /app
Expand Down

0 comments on commit 7480398

Please sign in to comment.