Skip to content

Commit

Permalink
Automated Container Builds & bump to sdk:6.0 (#28)
Browse files Browse the repository at this point in the history
* ci: Build & Push on commit to master

Signed-off-by: Joost Buskermolen <joost@buskervezel.nl>

* feat: multi-stage Dockerfile

Signed-off-by: Joost Buskermolen <joost@buskervezel.nl>

* fix: Set TargetFramework
dotnet/sdk#251

Signed-off-by: Joost Buskermolen <joost@buskervezel.nl>

* chore: Improve Dockerfile

Signed-off-by: Joost Buskermolen <joost@buskervezel.nl>

* fix: Include tessdata in runtime

Signed-off-by: Joost Buskermolen <joost@buskervezel.nl>

* fix: Add missing libtesseract4

Signed-off-by: Joost Buskermolen <joost@buskervezel.nl>

* fix: Missing -y

Signed-off-by: Joost Buskermolen <joost@buskervezel.nl>

Co-authored-by: Tentacule <git@tentacule.net>
  • Loading branch information
JoooostB and Tentacule committed Apr 17, 2022
1 parent 1219981 commit 73f8e71
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 5 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: ci

on:
push:
branches:
- 'master'

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: set lower case owner name
run: |
echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV}
env:
OWNER: '${{ github.repository_owner }}'
-
name: Checkout
uses: actions/checkout@v2
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ env.OWNER_LC }}
password: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile
platforms: linux/amd64
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/pgstosrt:latest
${{ secrets.DOCKERHUB_USERNAME }}/pgstosrt:${{ github.ref_name }}
ghcr.io/${{ env.OWNER_LC }}/pgstosrt:latest
ghcr.io/${{ env.OWNER_LC }}/pgstosrt:${{ github.ref_name }}
16 changes: 12 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0-focal-amd64 AS builder
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS builder

RUN apt-get update && \
apt-get install -y automake ca-certificates g++ git libtool libtesseract4 make pkg-config libc6-dev && \
Expand All @@ -7,14 +7,22 @@ RUN apt-get update && \
COPY . /src
RUN cd /src && \
dotnet restore && \
dotnet publish -c Release -f net6.0 -o /src/PgsToSrt/out && \
mv /src/entrypoint.sh /entrypoint.sh && chmod +x /entrypoint.sh && \
mv /src/PgsToSrt/out /app
dotnet publish -c Release -f net6.0 -o /src/PgsToSrt/out

FROM mcr.microsoft.com/dotnet/runtime:6.0
WORKDIR /app
ENV LANGUAGE=eng
ENV INPUT=/input.sup
ENV OUTPUT=/output.srt
VOLUME /tessdata

COPY --from=builder /src/PgsToSrt/out .
COPY --from=builder /tessdata /tessdata
COPY entrypoint.sh /entrypoint.sh

RUN apt-get update && \
apt-get install -y libtesseract4 \
&& chmod +x /entrypoint.sh

# Docker for Windows: EOL must be LF.
ENTRYPOINT /entrypoint.sh
2 changes: 1 addition & 1 deletion PgsToSrt/PgsToSrt.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net5.0;net6.0</TargetFrameworks>
<TargetFramework>net6.0</TargetFramework>
<AssemblyVersion>1.4.2.0</AssemblyVersion>
<FileVersion>1.4.2.0</FileVersion>
<Version>1.4.2</Version>
Expand Down

0 comments on commit 73f8e71

Please sign in to comment.