-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from miguelaeh/container_image
Add pipeless container image
- Loading branch information
Showing
10 changed files
with
291 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "pipeless-ai" | ||
version = "0.1.4" | ||
version = "0.1.5" | ||
description = "A framework to build and deploy multimodal perception apps in minutes without worrying about multimedia pipelines" | ||
authors = ["Miguel Angel Cabrera Minagorri <[email protected]>"] | ||
license = "Apache-2.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,27 @@ | ||
FROM bitnami/python:3.10 | ||
FROM bitnami/python:3.10.12 | ||
|
||
# Install gstreamer | ||
RUN install_packages libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \ | ||
libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base \ | ||
gstreamer1.0-plugins-good gstreamer1.0-plugins-bad \ | ||
gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools \ | ||
gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 \ | ||
gstreamer1.0-qt5 gstreamer1.0-pulseaudio | ||
|
||
# Hack to allow mp4 files without errors. Note this library provides hardware acceleration, so we need an alternative fix. | ||
#RUN apt-get remove gstreamer1.0-vaapi | ||
|
||
# Install required dependencies | ||
RUN install_packages libcairo2-dev libgirepository1.0-dev | ||
|
||
# Allow python to install packages as nonroot | ||
RUN mkdir /.local && chmod g+w /.local | ||
COPY scripts / | ||
|
||
RUN /python-nonroot.sh | ||
|
||
USER 1001 | ||
RUN pip install pipeless-ai pipeless-ai-cli | ||
|
||
# Allow to execute commands installed with pip | ||
ENV PATH="${PATH}:/.local/bin" | ||
|
||
RUN pip install pipeless-ai pipeless-ai-cli | ||
|
||
WORKDIR /app | ||
|
||
ENTRYPOINT ["pipeless"] | ||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,60 @@ | ||
# Working environment | ||
# Pipeless container library | ||
|
||
Please note the Dockerfile provided **IS NOT** ready for its usage | ||
This directory contains the source files to build the Pipeless container images. | ||
|
||
The container images provide a way to run Pipeless out-of-the box without having to deal with dependencies. | ||
|
||
## Image Usage | ||
|
||
Print help command: | ||
|
||
```console | ||
docker run --rm miguelaeh/pipeless --help | ||
``` | ||
|
||
Create a new project locally: | ||
|
||
```console | ||
docker run --rm -v /your/app/dir:/app miguelaeh/pipeless create project my_app_name | ||
``` | ||
|
||
Run all components: | ||
|
||
```console | ||
docker run --rm -v /your/app/dir:/app miguelaeh/pipeless run all | ||
``` | ||
|
||
Run input only: | ||
|
||
```console | ||
docker run --rm miguelaeh/pipeless run input | ||
``` | ||
|
||
### Install Custom Python Packages | ||
|
||
Sometimes, your app may require python packages that are not installed by default into the pipeless container. You can use the `PIPELESS_USER_PYTHON_PACKAGES` variable to automatically install them on start. You can specify them as a list separated by commas (`,`), semicolons (`;`) or spaces (` `). For example: | ||
|
||
```console | ||
docker run --rm -e "PIPELESS_USER_PYTHON_PACKAGES=opencv-python;some_other_package" miguelaeh/pipeless run worker | ||
``` | ||
|
||
### Important Notes | ||
|
||
If you want to store the processed media to a file, it must be done in a path under `/app`. For example, setting `PIPELESS_OUTPUT_VIDEO_URI=file:///app/my_video.mp4`. | ||
Futhermore, the directory mounted at `/app` (i.e. `/your/app/dir` on the above examples) must have group `root` with write permissions. | ||
|
||
## Docker compose usage | ||
|
||
The `docker-compose.yaml` file allows you to automatically deploy your application locally as if it would be deployed to the cloud. | ||
|
||
Start docker compose: | ||
|
||
```console | ||
APP_DIR=/your/app/dir docker compose up | ||
``` | ||
|
||
Stop the docker compose: | ||
|
||
```console | ||
APP_DIR=/your/app/dir docker compose down -v | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
version: "2" | ||
|
||
services: | ||
input: | ||
image: miguelaeh/pipeless:latest | ||
command: ['run', 'input'] | ||
volumes: | ||
- '${APP_DIR}:/app' | ||
environment: | ||
- PIPELESS_INPUT_ADDRESS_HOST=input | ||
- PIPELESS_INPUT_ADDRESS_PORT=1234 | ||
- PIPELESS_OUTPUT_ADDRESS_HOST=output | ||
- PIPELESS_OUTPUT_ADDRESS_PORT=1237 | ||
- PIPELESS_INPUT_VIDEO_URI=https://github.com/miguelaeh/pipeless/raw/main/examples/cats/cats.mp4 | ||
- PIPELESS_OUTPUT_VIDEO_URI=file:///app/output.mp4 | ||
|
||
output: | ||
image: miguelaeh/pipeless:latest | ||
command: ['run', 'output'] | ||
volumes: | ||
- '${APP_DIR}:/app' | ||
environment: | ||
- PIPELESS_INPUT_ADDRESS_HOST=input | ||
- PIPELESS_INPUT_ADDRESS_PORT=1234 | ||
- PIPELESS_OUTPUT_ADDRESS_HOST=output | ||
- PIPELESS_OUTPUT_ADDRESS_PORT=1237 | ||
- PIPELESS_INPUT_VIDEO_URI=https://github.com/miguelaeh/pipeless/raw/main/examples/cats/cats.mp4 | ||
- PIPELESS_OUTPUT_VIDEO_URI=file:///app/output.mp4 | ||
|
||
worker: | ||
image: miguelaeh/pipeless:latest | ||
command: ['run', 'worker'] | ||
volumes: | ||
- '${APP_DIR}:/app' | ||
environment: | ||
- PIPELESS_INPUT_ADDRESS_HOST=input | ||
- PIPELESS_INPUT_ADDRESS_PORT=1234 | ||
- PIPELESS_OUTPUT_ADDRESS_HOST=output | ||
- PIPELESS_OUTPUT_ADDRESS_PORT=1237 | ||
- PIPELESS_INPUT_VIDEO_URI=https://github.com/miguelaeh/pipeless/raw/main/examples/cats/cats.mp4 | ||
- PIPELESS_OUTPUT_VIDEO_URI=file:///app/output.mp4 | ||
- PIPELESS_USER_PYTHON_PACKAGES=opencv-python |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
# set -o xtrace # Uncomment this line for debugging purposes | ||
|
||
. /libpipeless.sh | ||
|
||
if [[ "$1" = "run" && ( "$2" = "worker" || "$2" = "all" ) ]]; then | ||
pipeless_install_user_python_deps | ||
fi | ||
|
||
if [[ "$1" = "pipeless" ]]; then | ||
exec "$@" | ||
else | ||
exec pipeless "$@" | ||
fi |
Oops, something went wrong.