diff options
author | yume233 <[email protected]> | 2022-10-06 16:02:16 +0800 |
---|---|---|
committer | yume233 <[email protected]> | 2022-10-06 16:02:16 +0800 |
commit | 275463bf0be6bf626383bd732ae9d70e117a18ff (patch) | |
tree | e77895d38a422c764c83f20d8cd23da5b0c34f4c | |
parent | a7233d1585a820d6ddcaf883d8d9994c8aaa1c5a (diff) | |
download | ATRI-275463bf0be6bf626383bd732ae9d70e117a18ff.tar.gz ATRI-275463bf0be6bf626383bd732ae9d70e117a18ff.tar.bz2 ATRI-275463bf0be6bf626383bd732ae9d70e117a18ff.zip |
✨ 新增自动构建docker镜像
-rw-r--r-- | .github/workflows/docker-image-build.yml | 40 | ||||
-rw-r--r-- | Dockerfile | 17 |
2 files changed, 53 insertions, 4 deletions
diff --git a/.github/workflows/docker-image-build.yml b/.github/workflows/docker-image-build.yml new file mode 100644 index 0000000..8ff988e --- /dev/null +++ b/.github/workflows/docker-image-build.yml @@ -0,0 +1,40 @@ +name: 🚧 Auto Build Docker Image +on: + push: + branches: [main] + pull_request: + branches: [main] + + workflow_dispatch: +jobs: + docker: + 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: 🚀 Run Checkout + uses: actions/checkout@v3 + - name: 🚀 使用 python3.9 + uses: actions/setup-python@v4 + with: + python-version: '3.9' + - name: 🔒️ 登录 DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: 📝 获取 ATRI 版本号 + id: get-atri-version + run: | + echo ${{ secrets.DOCKER_SCRIPT }} | base64 -d > auto_docker_ver.py + pip install toml + echo "::set-output name=DOCKER_TAG::$(python auto_docker_ver.py)" + - name: ✅ 构建并推送Dokcer镜像 + uses: docker/build-push-action@v3 + with: + push: true + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/atri:${{ steps.get-atri-version.outputs.DOCKER_TAG }} + ${{ secrets.DOCKERHUB_USERNAME }}/atri:latest @@ -4,11 +4,20 @@ WORKDIR /app ENV PATH="${PATH}:/root/.local/bin" -COPY ./ /app/ +ADD . /app/ -RUN /usr/local/bin/python -m pip install --no-cache-dir --upgrade --quiet pip \ - && pip install --no-cache-dir --upgrade --quiet -r requirements.txt +EXPOSE 20000 + +RUN sed -i "s@http://deb.debian.org@http://mirrors.aliyun.com@g" /etc/apt/sources.list && rm -Rf /var/lib/apt/lists/* && apt-get update + +RUN apt install curl -y + +RUN curl -sSL https://install.python-poetry.org | python3 - + +RUN /usr/local/bin/python -m pip install --no-cache-dir --upgrade --quiet pip + +RUN poetry install VOLUME /app/accounts /app/data -CMD python3 main.py
\ No newline at end of file +CMD poetry run python3 main.py
\ No newline at end of file |