From 275463bf0be6bf626383bd732ae9d70e117a18ff Mon Sep 17 00:00:00 2001 From: yume233 Date: Thu, 6 Oct 2022 16:02:16 +0800 Subject: =?UTF-8?q?=E2=9C=A8=20=E6=96=B0=E5=A2=9E=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=9E=84=E5=BB=BAdocker=E9=95=9C=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker-image-build.yml | 40 ++++++++++++++++++++++++++++++++ Dockerfile | 17 ++++++++++---- 2 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/docker-image-build.yml 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 diff --git a/Dockerfile b/Dockerfile index 6f3f8a2..2694202 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 -- cgit v1.2.3