Skip to content

Commit

Permalink
Merge pull request #2 from PPCBee/DOT-7022-rembg-gpu-dokku-tensorrt
Browse files Browse the repository at this point in the history
Dot 7022 rembg gpu dokku tensorrt
  • Loading branch information
Lajcisvk authored Mar 21, 2024
2 parents e549995 + b298cb6 commit 464c5cb
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
FROM python:3.10-slim
FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04

WORKDIR /rembg

COPY . .

RUN apt-get update
RUN apt-get install -y python-is-python3 python3 python3-pip
RUN python -m pip install ".[gpu,cli]"
RUN python -c 'from rembg.bg import download_models; download_models()'

Expand Down
61 changes: 61 additions & 0 deletions rembg/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# keep help at the beginning - this will be used as default command
.description: Generate list of targets with descriptions
help:
@grep -oz '^.description: .*\n.*:' Makefile | sed 'N;s;\.description: \(.*\)\n\(.*\):;"\x1b[1\;32m make \2 \x1b[0m" "\1";' | xargs printf "%-50s - %s\n"

# MACROS

DOCKER = docker-compose -f docker-compose.development.yml
DOCKER_DEV = $(DOCKER)
CFLAGS='-Wno-warning'

# use the rest as arguments for "run"
ARGS = `arg="$(filter-out $@,$(MAKECMDGOALS))" && echo $${arg:-${1}}`

# COMMANDS

# common
.description: start all services in DEVELOPMENT environment
start:
make stop backend
$(DOCKER_DEV) --profile all up -d

.description: stop all app services. You can pass service name as an argument
stop:
$(DOCKER) --profile all stop $(call ARGS)

.description: stop all services
down:
$(DOCKER) --profile all down

.description: build docker images
build:
$(DOCKER_DEV) --profile all build

.description: docker logs with follow option. You can pass service name as argument.
flogs:
$(DOCKER) logs --follow $(call ARGS)

.description: docker logs. You can pass service name as argument.
logs:
$(DOCKER) logs $(call ARGS)

.description: exec in the running service (pass service name and command as an argument). `make exec redis redis-cli`
exec:
$(DOCKER) exec $(call ARGS)

.description: attaches to backend process stdin
attach:
docker attach --detach-keys=ctrl-c $$($(DOCKER_DEV) ps -q backend)

.description: launches bash in backend container
bash:
$(DOCKER_DEV) exec backend bash

# Ignore unknown targets
%:
@:

# ...and turn them into do-nothing targets
_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
$(eval $(_ARGS):dummy;@:)
12 changes: 12 additions & 0 deletions rembg/docker-compose.development.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
services:
backend:
profiles:
- all
build:
context: .
tty: true
stdin_open: true
ports:
- "6100:7000"
environment:
OMP_NUM_THREADS: 4
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
python_requires=">=3.8, <3.13",
packages=find_packages(),
install_requires=install_requires,
dependency_links=['https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/'],
entry_points=entry_points,
extras_require=extras_require,
version=versioneer.get_version(),
Expand Down

0 comments on commit 464c5cb

Please sign in to comment.