Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated Container Builds & bump to sdk:6.0 #28

Merged
merged 8 commits into from
Apr 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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