Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added docker support + 1 command installation using docker-compose #8578

Merged
merged 6 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions Dockerfile.cpu
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
FROM ubuntu:latest AS builder

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update -y

RUN apt-get install -y g++ make pkg-config libopencv-dev

COPY . /darknet

WORKDIR /darknet

RUN rm Dockerfile.cpu

RUN rm Dockerfile.gpu

RUN rm Docker-compose.yml

RUN make

FROM ubuntu:latest

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update -y

RUN apt-get install -y sudo libgomp1

RUN useradd -U -m yolo

RUN usermod -aG sudo yolo

RUN usermod --shell /bin/bash yolo

RUN echo "yolo:yolo" | chpasswd

COPY --from=builder /darknet /home/yolo/darknet

RUN cp /home/yolo/darknet/libdarknet.so /usr/local/lib/libdarknet.so || echo "libso not used"

RUN cp /home/yolo/darknet/include/darknet.h /usr/local/include/darknet.h

RUN ldconfig

WORKDIR /home/yolo/darknet

USER yolo


47 changes: 47 additions & 0 deletions Dockerfile.gpu
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
FROM nvidia/cuda:11.6.0-cudnn8-devel-ubuntu20.04 AS builder

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update -y

RUN apt-get install -y g++ make pkg-config libopencv-dev

COPY . /darknet

WORKDIR /darknet

RUN rm Dockerfile.cpu

RUN rm Dockerfile.gpu

RUN rm Docker-compose.yml

RUN make

FROM nvidia/cuda:11.6.0-cudnn8-devel-ubuntu20.04

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update -y

RUN apt-get install -y sudo libgomp1

RUN useradd -U -m yolo

RUN usermod -aG sudo yolo

RUN usermod --shell /bin/bash yolo

RUN echo "yolo:yolo" | chpasswd

COPY --from=builder /darknet /home/yolo/darknet

RUN cp /home/yolo/darknet/libdarknet.so /usr/local/lib/libdarknet.so || echo "libso not used"

RUN cp /home/yolo/darknet/include/darknet.h /usr/local/include/darknet.h

RUN ldconfig

WORKDIR /home/yolo/darknet

USER yolo
20 changes: 20 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: '2'

services:
yolo-gpu:
build:
context: .
dockerfile: Dockerfile.gpu
image: yolo:gpu
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
yolo-cpu:
build:
context: .
dockerfile: Dockerfile.cpu
image: yolo:cpu