Create docker.yml (#7856)
Browse files* Create docker.yml
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update docker.yml
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update docker.yml
* Update docker.yml
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Cleanup
* Cleanup2
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
.github/workflows/docker.yml
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# YOLOv5 π by Ultralytics, GPL-3.0 license
|
2 |
+
|
3 |
+
name: Publish Docker Images
|
4 |
+
|
5 |
+
on:
|
6 |
+
push:
|
7 |
+
branches: [master]
|
8 |
+
# pull_request:
|
9 |
+
# branches: [master]
|
10 |
+
|
11 |
+
jobs:
|
12 |
+
docker:
|
13 |
+
name: Push Docker image to Docker Hub
|
14 |
+
runs-on: ubuntu-latest
|
15 |
+
steps:
|
16 |
+
- name: Checkout repo
|
17 |
+
uses: actions/checkout@v3
|
18 |
+
|
19 |
+
- name: Set up QEMU
|
20 |
+
uses: docker/setup-qemu-action@v2
|
21 |
+
|
22 |
+
- name: Set up Docker Buildx
|
23 |
+
uses: docker/setup-buildx-action@v2
|
24 |
+
|
25 |
+
- name: Login to Docker Hub
|
26 |
+
uses: docker/login-action@v2
|
27 |
+
with:
|
28 |
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
29 |
+
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
30 |
+
|
31 |
+
- name: Build and push CPU image
|
32 |
+
uses: docker/build-push-action@v3
|
33 |
+
with:
|
34 |
+
context: .
|
35 |
+
file: utils/docker/Dockerfile-cpu
|
36 |
+
push: true
|
37 |
+
tags: ultralytics/yolov5:latest-cpu
|
38 |
+
|
39 |
+
- name: Build and push GPU image
|
40 |
+
uses: docker/build-push-action@v3
|
41 |
+
with:
|
42 |
+
context: .
|
43 |
+
file: utils/docker/Dockerfile
|
44 |
+
push: true
|
45 |
+
tags: ultralytics/yolov5:latest
|
46 |
+
|
47 |
+
#- name: Build and push arm64 image
|
48 |
+
# uses: docker/build-push-action@v3
|
49 |
+
# with:
|
50 |
+
# context: .
|
51 |
+
# platforms: linux/arm64
|
52 |
+
# file: utils/docker/Dockerfile-arm64
|
53 |
+
# push: true
|
54 |
+
# tags: ultralytics/yolov5:latest-arm64
|
utils/docker/Dockerfile
CHANGED
@@ -15,7 +15,7 @@ COPY requirements.txt .
|
|
15 |
RUN python -m pip install --upgrade pip
|
16 |
RUN pip uninstall -y torch torchvision torchtext Pillow
|
17 |
RUN pip install --no-cache -r requirements.txt albumentations wandb gsutil notebook Pillow>=9.1.0 \
|
18 |
-
|
19 |
|
20 |
# Create working directory
|
21 |
RUN mkdir -p /usr/src/app
|
|
|
15 |
RUN python -m pip install --upgrade pip
|
16 |
RUN pip uninstall -y torch torchvision torchtext Pillow
|
17 |
RUN pip install --no-cache -r requirements.txt albumentations wandb gsutil notebook Pillow>=9.1.0 \
|
18 |
+
--extra-index-url https://download.pytorch.org/whl/cu113
|
19 |
|
20 |
# Create working directory
|
21 |
RUN mkdir -p /usr/src/app
|
utils/docker/{Dockerfile-M1 β Dockerfile-arm64}
RENAMED
@@ -34,7 +34,7 @@ RUN git clone https://github.com/ultralytics/yolov5 /usr/src/yolov5
|
|
34 |
# Usage Examples -------------------------------------------------------------------------------------------------------
|
35 |
|
36 |
# Build and Push
|
37 |
-
# t=ultralytics/yolov5:latest-M1 && sudo docker build --platform linux/arm64 -f utils/docker/Dockerfile-
|
38 |
|
39 |
# Pull and Run
|
40 |
# t=ultralytics/yolov5:latest-M1 && sudo docker pull $t && sudo docker run -it --ipc=host -v "$(pwd)"/datasets:/usr/src/datasets $t
|
|
|
34 |
# Usage Examples -------------------------------------------------------------------------------------------------------
|
35 |
|
36 |
# Build and Push
|
37 |
+
# t=ultralytics/yolov5:latest-M1 && sudo docker build --platform linux/arm64 -f utils/docker/Dockerfile-arm64 -t $t . && sudo docker push $t
|
38 |
|
39 |
# Pull and Run
|
40 |
# t=ultralytics/yolov5:latest-M1 && sudo docker pull $t && sudo docker run -it --ipc=host -v "$(pwd)"/datasets:/usr/src/datasets $t
|
utils/docker/Dockerfile-cpu
CHANGED
@@ -17,7 +17,7 @@ COPY requirements.txt .
|
|
17 |
RUN python3 -m pip install --upgrade pip
|
18 |
RUN pip install --no-cache -r requirements.txt albumentations gsutil notebook \
|
19 |
coremltools onnx onnx-simplifier onnxruntime openvino-dev tensorflow-cpu tensorflowjs \
|
20 |
-
|
21 |
|
22 |
# Create working directory
|
23 |
RUN mkdir -p /usr/src/app
|
|
|
17 |
RUN python3 -m pip install --upgrade pip
|
18 |
RUN pip install --no-cache -r requirements.txt albumentations gsutil notebook \
|
19 |
coremltools onnx onnx-simplifier onnxruntime openvino-dev tensorflow-cpu tensorflowjs \
|
20 |
+
--extra-index-url https://download.pytorch.org/whl/cpu
|
21 |
|
22 |
# Create working directory
|
23 |
RUN mkdir -p /usr/src/app
|