Skip to content

Commit d7d2b10

Browse files
Create docker.yml (#7856)
* 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>
1 parent e4d82c1 commit d7d2b10

File tree

4 files changed

+57
-3
lines changed

4 files changed

+57
-3
lines changed

.github/workflows/docker.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ COPY requirements.txt .
1515
RUN python -m pip install --upgrade pip
1616
RUN pip uninstall -y torch torchvision torchtext Pillow
1717
RUN pip install --no-cache -r requirements.txt albumentations wandb gsutil notebook Pillow>=9.1.0 \
18-
torch torchvision --extra-index-url https://download.pytorch.org/whl/cu113
18+
--extra-index-url https://download.pytorch.org/whl/cu113
1919

2020
# Create working directory
2121
RUN mkdir -p /usr/src/app

utils/docker/Dockerfile-M1 renamed to utils/docker/Dockerfile-arm64

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ RUN git clone https://github.com/ultralytics/yolov5 /usr/src/yolov5
3434
# Usage Examples -------------------------------------------------------------------------------------------------------
3535

3636
# Build and Push
37-
# t=ultralytics/yolov5:latest-M1 && sudo docker build --platform linux/arm64 -f utils/docker/Dockerfile-M1 -t $t . && sudo docker push $t
37+
# t=ultralytics/yolov5:latest-M1 && sudo docker build --platform linux/arm64 -f utils/docker/Dockerfile-arm64 -t $t . && sudo docker push $t
3838

3939
# Pull and Run
4040
# 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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ COPY requirements.txt .
1717
RUN python3 -m pip install --upgrade pip
1818
RUN pip install --no-cache -r requirements.txt albumentations gsutil notebook \
1919
coremltools onnx onnx-simplifier onnxruntime openvino-dev tensorflow-cpu tensorflowjs \
20-
torch torchvision --extra-index-url https://download.pytorch.org/whl/cpu
20+
--extra-index-url https://download.pytorch.org/whl/cpu
2121

2222
# Create working directory
2323
RUN mkdir -p /usr/src/app

0 commit comments

Comments
 (0)