Skip to content

Commit

Permalink
Switch from Alpine 3.19 to Edge
Browse files Browse the repository at this point in the history
  • Loading branch information
ptr727 committed Apr 4, 2024
1 parent fe6cd57 commit 85ad65f
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 10 deletions.
24 changes: 17 additions & 7 deletions .github/workflows/BuildDockerPush.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,21 @@ jobs:
docker.io/ptr727/plexcleaner:${{ endsWith(github.ref, 'refs/heads/main') && 'debian' || 'debian-develop' }}
# Alpine: linux/amd64,linux/arm64
- file: ./Docker/Alpine.dotNET.Dockerfile
# - file: ./Docker/Alpine.dotNET.Dockerfile
# platforms: linux/amd64,linux/arm64
# cache-scope: alpine
# secrets: SAVOURY_PPA_AUTH
# tags: |
# docker.io/ptr727/plexcleaner:${{ endsWith(github.ref, 'refs/heads/main') && 'alpine' || 'alpine-develop' }}

# Alpine Edge: linux/amd64,linux/arm64
- file: ./Docker/Alpine.Dockerfile
platforms: linux/amd64,linux/arm64
cache-scope: alpine
cache-scope: alpine-edge
secrets: SAVOURY_PPA_AUTH
tags: |
docker.io/ptr727/plexcleaner:${{ endsWith(github.ref, 'refs/heads/main') && 'alpine' || 'alpine-develop' }}
docker.io/ptr727/plexcleaner:${{ endsWith(github.ref, 'refs/heads/main') && 'alpine-edge' || 'alpine-edge-develop' }}
# Ubuntu: linux/amd64
- file: ./Docker/Ubuntu.dotNET.Savoury.Dockerfile
platforms: linux/amd64
Expand Down Expand Up @@ -189,8 +197,10 @@ jobs:
include:
- tag: ${{ endsWith(github.ref, 'refs/heads/main') && 'debian' || 'debian-develop' }}
file: debian.ver
- tag: ${{ endsWith(github.ref, 'refs/heads/main') && 'alpine' || 'alpine-develop' }}
file: alpine.ver
# - tag: ${{ endsWith(github.ref, 'refs/heads/main') && 'alpine' || 'alpine-develop' }}
# file: alpine.ver
- tag: ${{ endsWith(github.ref, 'refs/heads/main') && 'alpine-edge' || 'alpine-edge-develop' }}
file: alpine-edge.ver
- tag: ${{ endsWith(github.ref, 'refs/heads/main') && 'savoury' || 'savoury-develop' }}
file: savoury.ver
- tag: ${{ endsWith(github.ref, 'refs/heads/main') && 'arch' || 'arch-develop' }}
Expand Down Expand Up @@ -237,7 +247,7 @@ jobs:

steps:

# https://github.com/marketplace/actions/checkout
# https://github.com/marketplace/actions/checkout
- name: Checkout
uses: actions/checkout@v4

Expand Down
125 changes: 125 additions & 0 deletions Docker/Alpine.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Refer to Debian.dotNET.Dockerfile for build plan

# This is Alpine Edge and there is no MCR with .NET preinstalled

# There is no HandBrake package for arm/v7
# https://pkgs.alpinelinux.org/packages?name=handbrake&branch=edge&repo=&arch=&maintainer=

# Test image in shell:
# docker run -it --rm --pull always --name Testing alpine:edge /bin/sh
# docker run -it --rm --pull always --name Testing ptr727/plexcleaner:alpine /bin/sh

# Build Dockerfile
# docker buildx build --platform linux/amd64,linux/arm64 --tag testing:latest --file ./Docker/Alpine.Dockerfile .

# Test linux/amd64 target
# docker buildx build --progress plain --load --platform linux/amd64 --tag testing:latest --file ./Docker/Alpine.Dockerfile .
# docker run -it --rm --name Testing testing:latest /bin/sh



# Builder layer
# No MCR image for Edge
FROM --platform=$BUILDPLATFORM alpine:edge AS builder

# Layer workdir
WORKDIR /Builder

# Build platform args
ARG \
TARGETPLATFORM \
TARGETARCH \
BUILDPLATFORM

# PlexCleaner build attribute configuration
ARG BUILD_CONFIGURATION="Debug" \
BUILD_VERSION="1.0.0.0" \
BUILD_FILE_VERSION="1.0.0.0" \
BUILD_ASSEMBLY_VERSION="1.0.0.0" \
BUILD_INFORMATION_VERSION="1.0.0.0" \
BUILD_PACKAGE_VERSION="1.0.0.0"

# Install .NET SDK
# https://pkgs.alpinelinux.org/package/edge/community/x86_64/dotnet8-sdk
RUN apk --upgrade --no-cache add dotnet8-sdk

# Copy source and unit tests
COPY ./Samples/. ./Samples/.
COPY ./PlexCleanerTests/. ./PlexCleanerTests/.
COPY ./PlexCleaner/. ./PlexCleaner/.

# Unit Test
COPY ./Docker/UnitTest.sh ./
RUN chmod ugo+rwx ./UnitTest.sh
RUN ./UnitTest.sh

# Build
COPY ./Docker/Build.sh ./
RUN chmod ugo+rwx ./Build.sh
RUN ./Build.sh


# Final layer
FROM alpine:edge as final

# Image label
ARG LABEL_VERSION="1.0.0.0"
LABEL name="PlexCleaner" \
version=${LABEL_VERSION} \
description="Utility to optimize media files for Direct Play in Plex, Emby, Jellyfin" \
maintainer="Pieter Viljoen <[email protected]>"

# Enable .NET globalization, set default locale to en_US.UTF-8, and timezone to UTC
# https://github.com/dotnet/dotnet-docker/blob/main/samples/dotnetapp/Dockerfile.alpine-icu
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \
LANG=en_US.UTF-8 \
LANGUAGE=en_US:en \
LC_ALL=en_US.UTF-8 \
TZ=Etc/UTC

# Install .NET Runtime
# https://pkgs.alpinelinux.org/package/edge/community/x86_64/dotnet8-runtime
RUN apk --upgrade --no-cache add dotnet8-runtime

# Install prerequisites
RUN apk --upgrade --no-cache add \
icu-data-full \
icu-libs \
p7zip \
tzdata \
wget

# Install VS debug tools
# https://github.com/OmniSharp/omnisharp-vscode/wiki/Attaching-to-remote-processes
RUN wget https://aka.ms/getvsdbgsh \
&& sh getvsdbgsh -v latest -l /vsdbg \
&& rm getvsdbgsh

# Install media tools
# https://pkgs.alpinelinux.org/package/edge/community/x86_64/ffmpeg
# https://pkgs.alpinelinux.org/package/edge/community/x86_64/mediainfo
# https://pkgs.alpinelinux.org/package/edge/community/x86_64/mkvtoolnix
# https://pkgs.alpinelinux.org/package/edge/community/x86_64/handbrake
RUN apk --upgrade --no-cache add \
ffmpeg\
mediainfo \
mkvtoolnix \
handbrake

# Copy PlexCleaner from builder layer
COPY --from=builder /Builder/Publish/PlexCleaner/. /PlexCleaner

# Copy test script
COPY /Docker/Test.sh /Test/
RUN chmod -R ugo+rwx /Test

# Copy version script
COPY /Docker/Version.sh /PlexCleaner/
RUN chmod ugo+rwx /PlexCleaner/Version.sh

# Print version information
ARG TARGETPLATFORM \
BUILDPLATFORM
RUN if [ "$BUILDPLATFORM" = "$TARGETPLATFORM" ]; then \
/PlexCleaner/Version.sh; \
fi
2 changes: 2 additions & 0 deletions Docker/Alpine.dotNET.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# docker buildx build --progress plain --load --platform linux/amd64 --tag testing:latest --file ./Docker/Alpine.dotNET.Dockerfile .
# docker run -it --rm --name Testing testing:latest /bin/sh



# Builder layer
# https://github.com/dotnet/dotnet-docker/blob/main/src/sdk/8.0/alpine3.19/amd64/Dockerfile
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine3.19 AS builder
Expand Down
8 changes: 6 additions & 2 deletions Docker/README.m4
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ Images are updated weekly with the latest upstream updates.
- Media processing tools are installed from the standard repositories.
- Multi-architecture image supporting `linux/amd64`, and `linux/arm64`.
- There is currently no `linux/arm/v7` package for [HandBrake](https://pkgs.alpinelinux.org/packages?name=handbrake&branch=edge&repo=&arch=&maintainer=).
- `alpine-edge`: Builds using [Alpine Edge](https://hub.docker.com/_/alpine/) as base image.
- Media processing tools are installed from the standard repositories.
- Multi-architecture image supporting `linux/amd64`, and `linux/arm64`.
- There is currently no `linux/arm/v7` package for [HandBrake](https://pkgs.alpinelinux.org/packages?name=handbrake&branch=edge&repo=&arch=&maintainer=).
- `debian`: Builds using [Microsoft .NET pre-installed on Debian](https://hub.docker.com/_/microsoft-dotnet-sdk/) as base image.
- Media processing tools are installed from the standard repositories.
- Multi-architecture image supporting `linux/amd64`, `linux/arm64`, and `linux/arm/v7` builds.
Expand Down Expand Up @@ -68,10 +72,10 @@ include({{savoury.ver}})
include({{debian.ver}})
```

### `ptr727/plexcleaner:alpine`
### `ptr727/plexcleaner:alpine-edge`

```text
include({{alpine.ver}})
include({{alpine-edge.ver}})
```

### `ptr727/plexcleaner:arch`
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ Docker images are published on [Docker Hub][docker-link].

## Release Notes

- Version 3.6:
- Disabling Alpine 3.19 release builds and switching to Alpine Edge.
- Handbrake is only available on Edge, and mixing released and Edge versions cause too many [issues](https://gitlab.alpinelinux.org/alpine/aports/-/issues/15949).
- Alpine stable release builds will no longer be built, or not until Handbrake is supported on stable releases.
- Alpine Edge builds will be tagged as `alpine-edge`.
- Version 3.5:
- Download 7-Zip builds from [GitHub](https://github.com/ip7z/7zip/releases), fixes [issue #324](https://github.com/ptr727/PlexCleaner/issues/324).
- Update Alpine Docker image to 3.19.
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "3.5",
"version": "3.6",
"publicReleaseRefSpec": [
"^refs/heads/main$"
],
Expand Down

0 comments on commit 85ad65f

Please sign in to comment.