Skip to content

Commit

Permalink
add bmf cpu Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
HuHeng committed Jan 26, 2024
1 parent d0d9c66 commit c721b0d
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 0 deletions.
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}"
8 changes: 8 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ then
then
LOCAL_BUILD=0
fi
if [ "$1" = "disable" ]
then
shift
if [ "$1" = "cuda" ]
then
CUDA_ENABLE=OFF
fi
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

0 comments on commit c721b0d

Please sign in to comment.