Merge pull request #406 from Mmx233/Bot

This commit is contained in:
惜月 2023-06-14 19:39:00 +08:00 committed by GitHub
commit b862431019
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 69 additions and 0 deletions

43
.github/workflows/release_docker.yaml vendored Normal file
View File

@ -0,0 +1,43 @@
name: Release Docker Image
on:
push:
tags:
- v**
workflow_dispatch:
jobs:
Release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Docker Buildx Command
id: buildx
uses: docker/setup-buildx-action@master
- name: Login to docker registry
uses: docker/login-action@v2
with:
registry: ${{ secrets.DOCKER_IMAGE_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Get Docker Image Url
id: image
env:
URL: ${{ secrets.DOCKER_IMAGE_REGISTRY }}${{ secrets.DOCKER_IMAGE_PATH }}
run: |
echo LATEST=${URL}:latest >> $GITHUB_OUTPUT
echo VERSION=${URL}:${GITHUB_REF/refs\/tags\//} >> $GITHUB_OUTPUT
- name: Build Docker Image and Push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
context: .
file: ./dockerfile
tags: ${{ steps.image.outputs.VERSION }},${{ steps.image.outputs.LATEST }}

26
dockerfile Normal file
View File

@ -0,0 +1,26 @@
FROM python:slim
RUN pip3 --no-cache-dir install nb-cli
ENV TZ=Asia/Shanghai \
DEBIAN_FRONTEND=noninteractive
RUN ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime && \
echo ${TZ} > /etc/timezone && \
dpkg-reconfigure --frontend noninteractive tzdata
RUN apt-get update && apt-get install -y git && \
rm -rf /var/lib/apt/lists/*
WORKDIR /data/pkg
COPY . .
RUN sed -i 's/^\-\-index\-url\s.*$//' requirements.txt && \
pip3 install --no-cache-dir -r requirements.txt
RUN playwright install-deps && \
playwright install chromium && \
rm -rf /var/lib/apt/lists/*
CMD ["nb", "run"]