mirror of
https://github.com/BililiveRecorder/BililiveRecorder.git
synced 2024-11-16 11:42:22 +08:00
Update dockerfile and GitHub Actions workflow
This commit is contained in:
parent
40900103a0
commit
5f9f506139
|
@ -11,6 +11,10 @@ indent_size = 4
|
|||
charset = utf-8
|
||||
insert_final_newline = true
|
||||
|
||||
[*.yml]
|
||||
|
||||
indent_size = 2
|
||||
|
||||
[NLog.{Debug,Release}.config]
|
||||
|
||||
indent_size = 2
|
||||
|
|
10
.github/workflows/build.yml
vendored
10
.github/workflows/build.yml
vendored
|
@ -82,6 +82,7 @@ jobs:
|
|||
build_docker:
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name != 'pull_request'
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
@ -94,11 +95,11 @@ jobs:
|
|||
uses: docker/setup-qemu-action@v1
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- name: Log into registry ${{ env.REGISTRY }}
|
||||
- name: Login to GitHub Container Registry
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v1
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
# Extract metadata (tags, labels) for Docker
|
||||
|
@ -107,7 +108,8 @@ jobs:
|
|||
id: meta
|
||||
uses: docker/metadata-action@v3
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
images: |
|
||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
- name: Build CLI
|
||||
run: dotnet build -c Release -o ./BililiveRecorder.Cli/bin/docker_out BililiveRecorder.Cli/BililiveRecorder.Cli.csproj
|
||||
# Build and push Docker image with Buildx (don't push on PR)
|
||||
|
|
16
.github/workflows/release.yml
vendored
16
.github/workflows/release.yml
vendored
|
@ -126,20 +126,28 @@ jobs:
|
|||
uses: docker/setup-buildx-action@v1
|
||||
# Login against a Docker registry except on PR
|
||||
# https://github.com/docker/login-action
|
||||
- name: Log into registry ${{ env.REGISTRY }}
|
||||
- name: Login to GitHub Container Registry
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v1
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Login to Docker Hub
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
# Extract metadata (tags, labels) for Docker
|
||||
# https://github.com/docker/metadata-action
|
||||
- name: Extract Docker metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v3
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
images: |
|
||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
bililive/recorder
|
||||
- name: Build CLI
|
||||
run: dotnet build -c Release -o ./BililiveRecorder.Cli/bin/docker_out BililiveRecorder.Cli/BililiveRecorder.Cli.csproj
|
||||
# Build and push Docker image with Buildx (don't push on PR)
|
||||
|
|
|
@ -5,8 +5,8 @@ RUN cd /src/BililiveRecorder.Cli && dotnet build -o /output -c Release
|
|||
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine
|
||||
RUN apk add --no-cache tzdata
|
||||
ENV TZ=Asia/Shanghai
|
||||
COPY --from=0 /output /app
|
||||
VOLUME [ "/rec" ]
|
||||
WORKDIR /app
|
||||
VOLUME [ "/rec" ]
|
||||
COPY --from=0 /output /app
|
||||
ENTRYPOINT [ "/app/BililiveRecorder.Cli" ]
|
||||
CMD [ "run", "/rec" ]
|
||||
CMD [ "run", "--bind", "http://*:2356", "/rec" ]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
FROM mcr.microsoft.com/dotnet/aspnet:6.0
|
||||
ENV TZ=Asia/Shanghai
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
COPY ./BililiveRecorder.Cli/bin/docker_out /app
|
||||
VOLUME [ "/rec" ]
|
||||
WORKDIR /app
|
||||
VOLUME [ "/rec" ]
|
||||
COPY ./BililiveRecorder.Cli/bin/docker_out /app
|
||||
ENTRYPOINT [ "dotnet", "/app/BililiveRecorder.Cli.dll" ]
|
||||
CMD [ "run", "/rec" ]
|
||||
CMD [ "run", "--bind", "http://*:2356", "/rec" ]
|
||||
|
|
Loading…
Reference in New Issue
Block a user