diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..7cc0a70 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,54 @@ +name: Docker Build and Publish + +on: + push: + branches: + - main + workflow_dispatch: + +env: + DOCKERHUB_USERNAME: ${{ secrets.DOCKER_USERNAME }} + DOCKERHUB_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + +jobs: + build-and-push: + runs-on: ubuntu-latest + strategy: + matrix: + os: [ ubuntu-latest ] + arch: [ amd64, arm64 ] + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Login to DockerHub + run: echo "${DOCKERHUB_PASSWORD}" | docker login --username "${DOCKERHUB_USERNAME}" --password-stdin + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + + - name: Build and push AMD64 image + uses: docker/build-push-action@v2 + with: + context: . + push: true + platforms: linux/amd64 + tags: ${DOCKERHUB_USERNAME}:latest + + - name: Build and push ARM64 image + uses: docker/build-push-action@v2 + with: + context: . + push: true + platforms: linux/arm64 + tags: ${DOCKERHUB_USERNAME}:latest-arm-linux + + + + + diff --git a/Dockerfile b/Dockerfile index b7af664..65135ad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,17 +8,6 @@ COPY . /app WORKDIR /app # 安装所需依赖 -#RUN apt-get update --fix-missing \ -# && apt-get install ffmpeg libsm6 libxext6 -y \ -# && pip install --upgrade pip \ -# && pip install -r requirements.txt \ -# && pip install -r yolov5/requirements.txt \ -# && pip install torch==1.13.0 torchvision==0.14.0 --index-url https://download.pytorch.org/whl/cpu \ -## && apt-get install -y libgl1-mesa-glx \ -# # 删除缓存文件 -# && rm -rf /var/lib/apt/lists/* \ -# && rm -rf ~/.cache/pip - RUN pip install --upgrade pip \ && pip install -r requirements.txt \ && pip install torch==1.13.0 torchvision==0.14.0 --index-url https://download.pytorch.org/whl/cpu \