From 10090c1ac3a07ec84bdfbb8730573b7bf0a136d7 Mon Sep 17 00:00:00 2001 From: TheTaylorLee <53202926+TheTaylorLee@users.noreply.github.com> Date: Sun, 4 Feb 2024 10:58:26 -0600 Subject: [PATCH] 3.0.0 --- .dockerignore | 1 + .github/workflows/dev-alpine3.17-amd64.yml | 50 ++++++++ .../old/Dockerfile.alpine3.14-lts-amd64 | 0 .../old/Dockerfile.ubuntu22.04-lts-amd64 | 0 .../{ => old}/dev-alpine3.14-lts-amd64.yml | 0 .../{ => old}/dev-ubuntu22.04-lts-amd64.yml | 0 .github/workflows/old/prod-alpine-amd64.yml | 49 ++++++++ .../workflows/{ => old}/prod-ubuntu-amd64.yml | 0 .github/workflows/prod-alpine-amd64.yml | 6 +- Dockerfile.alpine3.17-amd64 | 114 ++++++++++++++++++ README.md | 1 + changelog.md | 3 +- version | 2 +- 13 files changed, 221 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/dev-alpine3.17-amd64.yml rename Dockerfile.alpine3.14-lts-amd64 => .github/workflows/old/Dockerfile.alpine3.14-lts-amd64 (100%) rename Dockerfile.ubuntu22.04-lts-amd64 => .github/workflows/old/Dockerfile.ubuntu22.04-lts-amd64 (100%) rename .github/workflows/{ => old}/dev-alpine3.14-lts-amd64.yml (100%) rename .github/workflows/{ => old}/dev-ubuntu22.04-lts-amd64.yml (100%) create mode 100644 .github/workflows/old/prod-alpine-amd64.yml rename .github/workflows/{ => old}/prod-ubuntu-amd64.yml (100%) create mode 100644 Dockerfile.alpine3.17-amd64 diff --git a/.dockerignore b/.dockerignore index 7f0649d..434a91f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -5,6 +5,7 @@ build.sh changelog.md examples Dockerfile.alpine3.14-lts-amd64 +Dockerfile.alpine3.17-amd64 Dockerfile.ubuntu22.04-lts-amd64 LICENSE readme.md diff --git a/.github/workflows/dev-alpine3.17-amd64.yml b/.github/workflows/dev-alpine3.17-amd64.yml new file mode 100644 index 0000000..d8d6837 --- /dev/null +++ b/.github/workflows/dev-alpine3.17-amd64.yml @@ -0,0 +1,50 @@ +name: dev-alpine3.17-amd64 + +"on": + # pull_request: + # types: + # - opened + push: + branches-ignore: + - main + workflow_dispatch: + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Get tag + id: repository + run: echo "tag=$(cat version)" > $GITHUB_ENV + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.API_TOKEN }} + + - name: Build and push alpine + uses: docker/build-push-action@v3 + with: + context: . + file: Dockerfile.alpine3.17-amd64 + platforms: linux/amd64 + push: true + tags: | + ghcr.io/thetaylorlee/docker-transcodeautomation:alpine3.17-amd64-develop-${{ env.tag }} + ghcr.io/thetaylorlee/docker-transcodeautomation:alpine3.17-amd64-develop diff --git a/Dockerfile.alpine3.14-lts-amd64 b/.github/workflows/old/Dockerfile.alpine3.14-lts-amd64 similarity index 100% rename from Dockerfile.alpine3.14-lts-amd64 rename to .github/workflows/old/Dockerfile.alpine3.14-lts-amd64 diff --git a/Dockerfile.ubuntu22.04-lts-amd64 b/.github/workflows/old/Dockerfile.ubuntu22.04-lts-amd64 similarity index 100% rename from Dockerfile.ubuntu22.04-lts-amd64 rename to .github/workflows/old/Dockerfile.ubuntu22.04-lts-amd64 diff --git a/.github/workflows/dev-alpine3.14-lts-amd64.yml b/.github/workflows/old/dev-alpine3.14-lts-amd64.yml similarity index 100% rename from .github/workflows/dev-alpine3.14-lts-amd64.yml rename to .github/workflows/old/dev-alpine3.14-lts-amd64.yml diff --git a/.github/workflows/dev-ubuntu22.04-lts-amd64.yml b/.github/workflows/old/dev-ubuntu22.04-lts-amd64.yml similarity index 100% rename from .github/workflows/dev-ubuntu22.04-lts-amd64.yml rename to .github/workflows/old/dev-ubuntu22.04-lts-amd64.yml diff --git a/.github/workflows/old/prod-alpine-amd64.yml b/.github/workflows/old/prod-alpine-amd64.yml new file mode 100644 index 0000000..58fd786 --- /dev/null +++ b/.github/workflows/old/prod-alpine-amd64.yml @@ -0,0 +1,49 @@ +name: prod-alpine-amd64 + +"on": + pull_request: + branches: + - main + types: + - closed + +jobs: + build-and-push-alpine-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Get tag + id: repository + run: echo "tag=$(cat version)" > $GITHUB_ENV + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.API_TOKEN }} + + - name: Build and push alpine + uses: docker/build-push-action@v3 + with: + context: . + file: Dockerfile.alpine3.14-lts-amd64 + platforms: linux/amd64 + push: true + tags: | + ghcr.io/thetaylorlee/docker-transcodeautomation:alpine3.14-lts-amd64-${{ env.tag }} + ghcr.io/thetaylorlee/docker-transcodeautomation:alpine3.14-lts-amd64 + ghcr.io/thetaylorlee/docker-transcodeautomation:latest diff --git a/.github/workflows/prod-ubuntu-amd64.yml b/.github/workflows/old/prod-ubuntu-amd64.yml similarity index 100% rename from .github/workflows/prod-ubuntu-amd64.yml rename to .github/workflows/old/prod-ubuntu-amd64.yml diff --git a/.github/workflows/prod-alpine-amd64.yml b/.github/workflows/prod-alpine-amd64.yml index 58fd786..ff02d90 100644 --- a/.github/workflows/prod-alpine-amd64.yml +++ b/.github/workflows/prod-alpine-amd64.yml @@ -40,10 +40,10 @@ jobs: uses: docker/build-push-action@v3 with: context: . - file: Dockerfile.alpine3.14-lts-amd64 + file: Dockerfile.alpine3.17-amd64 platforms: linux/amd64 push: true tags: | - ghcr.io/thetaylorlee/docker-transcodeautomation:alpine3.14-lts-amd64-${{ env.tag }} - ghcr.io/thetaylorlee/docker-transcodeautomation:alpine3.14-lts-amd64 + ghcr.io/thetaylorlee/docker-transcodeautomation:alpine3.17-amd64-${{ env.tag }} + ghcr.io/thetaylorlee/docker-transcodeautomation:alpine3.17-amd64 ghcr.io/thetaylorlee/docker-transcodeautomation:latest diff --git a/Dockerfile.alpine3.17-amd64 b/Dockerfile.alpine3.17-amd64 new file mode 100644 index 0000000..67902b4 --- /dev/null +++ b/Dockerfile.alpine3.17-amd64 @@ -0,0 +1,114 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# Modified by Taylor Lee to include additonal customizations under the MIT License. + +# Docker image file that describes an Alpine image with PowerShell installed from .tar.gz file(s) +ARG hostRegistry=psdockercache.azurecr.io +FROM ${hostRegistry}/alpine:3.17 AS installer-env + +# Define Args for the needed to add the package +ARG PS_VERSION=7.3.0-preview.8 +ARG PS_PACKAGE=powershell-${PS_VERSION}-linux-alpine-x64.tar.gz +ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE} +ARG PS_INSTALL_VERSION=7-preview + +# Download the Linux tar.gz and save it +ADD ${PS_PACKAGE_URL} /tmp/linux.tar.gz + +# define the folder we will be installing PowerShell to +ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION + +# Create the install folder +RUN mkdir -p ${PS_INSTALL_FOLDER} + +# Unzip the Linux tar.gz +RUN tar zxf /tmp/linux.tar.gz -C ${PS_INSTALL_FOLDER} -v + +# Start a new stage so we lose all the tar.gz layers from the final image +ARG hostRegistry=psdockercache.azurecr.io +FROM ${hostRegistry}/alpine:3.17 + +# Add Labels (Modified entry) +LABEL org.opencontainers.image.source=https://github.com/thetaylorlee/docker-transcodeautomation +LABEL org.opencontainers.image.description="An automated media transcoding solution." +LABEL org.opencontainers.image.licenses=MIT + +# Copy only the files we need from the previous stage +COPY --from=installer-env ["/opt/microsoft/powershell", "/opt/microsoft/powershell"] + +# Define Args and Env needed to create links +ARG PS_INSTALL_VERSION=7-preview +ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \ + \ + # Define ENVs for Localization/Globalization + DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \ + LC_ALL=en_US.UTF-8 \ + LANG=en_US.UTF-8 \ + # set a fixed location for the Module analysis cache + PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache \ + POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-Alpine-3.17 \ + # Set FFTools variables (Modified entry) + FFToolsSource=/docker-transcodeautomation/transcoding/ \ + FFToolsTarget=/docker-transcodeautomation/transcoding/new/ + +# Install dotnet dependencies and ca-certificates +RUN apk add --no-cache \ + ca-certificates \ + less \ + \ + # PSReadline/console dependencies + ncurses-terminfo-base \ + \ + # .NET Core dependencies + krb5-libs \ + libgcc \ + libintl \ + libssl1.1 \ + libstdc++ \ + tzdata \ + userspace-rcu \ + zlib \ + # Install ffmpeg (Modified entry) + ffmpeg \ + icu-libs \ + && apk -X https://dl-cdn.alpinelinux.org/alpine/edge/main add --no-cache \ + lttng-ust \ + \ + # PowerShell remoting over SSH dependencies + openssh-client \ + \ + && apk update \ + && apk upgrade \ + # Create the pwsh symbolic link that points to powershell + && ln -s ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh \ + \ + # Create the pwsh-preview symbolic link that points to powershell + && ln -s ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh-preview \ + # Give all user execute permissions and remove write permissions for others + && chmod a+x,o-w ${PS_INSTALL_FOLDER}/pwsh \ + # intialize powershell module cache + # and disable telemetry + && export POWERSHELL_TELEMETRY_OPTOUT=1 \ + && pwsh \ + -NoLogo \ + -NoProfile \ + -Command " \ + \$ErrorActionPreference = 'Stop' ; \ + \$ProgressPreference = 'SilentlyContinue' ; \ + while(!(Test-Path -Path \$env:PSModuleAnalysisCachePath)) { \ + Write-Host "'Waiting for $env:PSModuleAnalysisCachePath'" ; \ + Start-Sleep -Seconds 6 ; \ + }" \ + # Create directories where powershell profile will be saved (Modified Entry) + mkdir /root/.config \ + mkdir /root/.config/powershell + +# Copy in modules (Modified entry) +COPY build /docker-transcodeautomation +COPY modules/PSSQLite /root/.local/share/powershell/Modules/PSSQLite +COPY modules/MediaFunctions /root/.local/share/powershell/Modules/MediaFunctions +COPY modules/Microsoft.PowerShell_profile.ps1 /root/.config/powershell/Microsoft.PowerShell_profile.ps1 + +# Use PowerShell as the default shell +# Use array to avoid Docker prepending /bin/sh -c (Modified entry) +CMD [ "pwsh", "-f", "/docker-transcodeautomation/Invoke-TranscodeAutomation.ps1" ] \ No newline at end of file diff --git a/README.md b/README.md index 6ad9d0e..74cc755 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,7 @@ Media | Top volume containing media files | /media:/media Build | Architecture | Updated ---------|----------|--------- Alpine3.14-lts | amd64 | yes +Alpine3.17 | amd64 | yes Ubuntu22.04-lts | amd64 | yes Tags | Description diff --git a/changelog.md b/changelog.md index 3ea35d5..4b3e4db 100644 --- a/changelog.md +++ b/changelog.md @@ -55,4 +55,5 @@ - 2.24.1 Update readme and remove legacy module functions - 2.24.2 Failed to use a dev branch for 2.24.1 and workflows didn't run. Using 2.24.2 to trigger workflows and test for bugs. - 2.25.0 Add the following to surpress verbose output, but still display stats. This will make logs easier to read by removing thousands of unneeded lines. (-hide_banner -loglevel error -stats) -- 2.25.1 Add the suppress output parameters to Invoke-Process functions. Larger file sizes resulted in updating metadata only and those runs of ffmpeg were missing the parameters. \ No newline at end of file +- 2.25.1 Add the suppress output parameters to Invoke-Process functions. Larger file sizes resulted in updating metadata only and those runs of ffmpeg were missing the parameters. +- 3.0.0 Deprecating Ubuntu Build and update alpine build \ No newline at end of file diff --git a/version b/version index a4057dd..1c5ae58 100644 --- a/version +++ b/version @@ -1 +1 @@ -v2.25.1 \ No newline at end of file +v3.0.0 \ No newline at end of file