Skip to content

Commit

Permalink
Merge pull request #3 from thewhobox/master
Browse files Browse the repository at this point in the history
updated dockerfile
  • Loading branch information
thewhobox authored Oct 4, 2023
2 parents ed070c7 + 75f00e2 commit c8568a4
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 28 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Docker Build CI

on:
push:
branches:
- 'publish'
pull_request:

jobs:

build:

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/[email protected]
with:
file: ShareLoader/Dockerfile
platforms: linux/arm/v7,linux/amd64
push: false
tags: thewhobox/shareloader:latest
44 changes: 20 additions & 24 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name: Docker Image CI

on:
push:
branches: [ "docker" ]
pull_request:
branches: [ "docker" ]
workflow_dispatch:
merge_group:

jobs:

Expand All @@ -13,23 +11,21 @@ jobs:
runs-on: ubuntu-latest

steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v3
with:
context: ShareLoader/
platforms: linux/arm64,linux/armv7,linux/armv8
push: true
tags: thewhobox/shareloader:latest
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/[email protected]
with:
file: ShareLoader/Dockerfile
platforms: linux/arm/v7,linux/amd64
push: true
tags: thewhobox/shareloader:latest
30 changes: 26 additions & 4 deletions ShareLoader/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,41 @@ WORKDIR /app
RUN apt-get update && apt-get install -y p7zip-full
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["ShareLoader/ShareLoader.csproj", "ShareLoader/"]
COPY ["ShareLoader.Share/ShareLoader.Share.csproj", "ShareLoader.Share/"]
RUN dotnet restore "ShareLoader/ShareLoader.csproj"
COPY . .
WORKDIR "/src/ShareLoader"
RUN dotnet build "ShareLoader.csproj" -c Release -o /app/build -r linux-x64
ARG TARGETPLATFORM
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
RID=linux-x64 ; \
elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
RID=linux-arm64 ; \
elif [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then \
RID=linux-arm ; \
echo "this ist arm" ; \
fi \
&& dotnet build "ShareLoader.csproj" -c Release -o /app/build -r $RID

FROM build AS publish
RUN dotnet publish "ShareLoader.csproj" -c Release -o /app/publish -r linux-x64
ARG TARGETPLATFORM
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
RID=linux-x64 ; \
elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
RID=linux-arm64 ; \
elif [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then \
RID=linux-arm ; \
echo "this ist arm" ; \
fi \
&& dotnet publish "ShareLoader.csproj" -c Release -o /app/publish -r $RID --self-contained false /p:PublishSingleFile=false /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["./ShareLoader"]

ENV DDL_APIKEY=
ENV OMDB_APIKEY=

ENTRYPOINT ["./ShareLoader"]

0 comments on commit c8568a4

Please sign in to comment.