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

add bmf cpu Dockerfile #98

Merged
merged 3 commits into from
Feb 18, 2024
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
48 changes: 48 additions & 0 deletions .github/workflows/build_docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build and push docker image

on:
workflow_dispatch:
push:
tags:
- 'v*'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Check out source code
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
#if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v4
with:
push: true
context: .
file: ./docker/Dockerfile.cpu
tags: ${{ steps.meta.outputs.tags }}
build-args: |
"GITHUB_ACTIONS=${GITHUB_ACTIONS}"
4 changes: 4 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ then
then
LOCAL_BUILD=0
fi
if [ "$1" = "disable_cuda" ]
then
CUDA_ENABLE=OFF
fi
fi

mkdir -p output
Expand Down
29 changes: 29 additions & 0 deletions docker/Dockerfile.cpu
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM ubuntu:20.04

ARG DEVICE=cpu
ARG GITHUB_ACTIONS

ENV GITHUB_ACTIONS=${GITHUB_ACTIONS}
ENV DEBIAN_FRONTEND noninteractive

# required
RUN apt update \
&& apt install -y make git pkg-config libssl-dev cmake python3 python3-dev python3-pip binutils-dev libgoogle-glog-dev gcc g++

# optional
RUN apt install -y libopencv-dev libomp-dev libtorch3-dev

RUN pip install setuptools timeout_decorator

COPY ./ /root/bmf/
WORKDIR /root/bmf/

# ffmpeg installed via apt has no development libraries, so we build it from source
RUN scripts/build_ffmpeg.sh --device=$DEVICE nasm yasm x264 x265 fdk-aac opus \
&& rm -rf ffmpeg_source

RUN ./build.sh disable_cuda && rm -rf .git && ./build.sh clean

ENV LD_LIBRARY_PATH=/root/bmf/output/bmf/lib
ENV PATH=${PATH}:/root/bmf/output/bmf/bin
ENV PYTHONPATH=/root/bmf/output
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ def build_extension(self, ext: CMakeExtension) -> None:
author_email="",
python_requires='>= 3.6',
description="Babit Multimedia Framework",
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
readme='README.md',
url="https://github.com/BabitMF/bmf",
install_requires=[
Expand Down
Loading