summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/docker-image-build.yml40
-rw-r--r--Dockerfile17
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
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