Skip to content

Commit

Permalink
feat: v0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
caviri committed Feb 21, 2025
1 parent 736b9fb commit c72eec6
Show file tree
Hide file tree
Showing 17 changed files with 760 additions and 180 deletions.
19 changes: 14 additions & 5 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ TASK=
LANGUAGE=
INPUT_FILE=
OUTPUT_FILE=
QUANTIZE=

# VARIABLES RELATED TO THE FULL PIPELINE
FULL_PIPELINE=
INPUT_METADATA_FILE=
S3_MEDIA_BUCKET=
S3_MEDIA_REGION=
S3_MEDIA_SECRET=
S3_MEDIA_KEY=

# ODTP ENV VARIABLES FOR API MODE
ODTP_API_MODE=
ODTP_GRADIO_SHARE=

# ODTP ENV VARIABLES TO CONNECT
ODTP_MONGO_SERVER=
Expand All @@ -19,8 +32,4 @@ ODTP_DIGITAL_TWIN=
ODTP_EXCUTION=
ODTP_STEP=
ODTP_COMPONENT=
ODTP_COMPONENT_VERSION=

#ODTP_API_MODE=TRUE
#ODTP_GRADIO_SHARE=TRUE
TODO: User and password
ODTP_COMPONENT_VERSION=
57 changes: 57 additions & 0 deletions .github/workflows/multiplatform_docker_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Multi-Platform Docker Build

on:
workflow_dispatch:

jobs:
build-and-publish:
runs-on: ubuntu-latest

steps:
# Step 1: Check out the repository and submodules
- name: Check out code
uses: actions/checkout@v3
with:
submodules: true # Fetch submodules
fetch-depth: 0 # Ensure the full history is fetched

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

# Step 3: Install yq
- name: Install yq
run: |
sudo apt-get update && sudo apt-get install -y wget
sudo wget https://github.com/mikefarah/yq/releases/download/v4.35.1/yq_linux_amd64 -O /usr/bin/yq
sudo chmod +x /usr/bin/yq
# Step 4: Extract component-version and component-name from odtp.yml
- name: Extract component-version and component-name
id: extract_info
run: |
VERSION=$(yq e '.component-version' odtp.yml)
NAME=$(yq e '.component-name' odtp.yml)
echo "VERSION=${VERSION}"
echo "NAME=${NAME}"
echo "COMPONENT_VERSION=${VERSION}" >> $GITHUB_ENV
echo "COMPONENT_NAME=${NAME}" >> $GITHUB_ENV
# Step 5: Log in to GitHub Container Registry
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Step 6: Build and push Docker image for multiple platforms
- name: Build and push Docker image
run: |
IMAGE_NAME=ghcr.io/${{ github.repository }}/${{ env.COMPONENT_NAME }}
docker buildx build \
--platform linux/amd64,linux/arm64 \
--build-arg COMPONENT_VERSION=${{ env.COMPONENT_VERSION }} \
-t $IMAGE_NAME:${{ env.COMPONENT_VERSION }} \
-t $IMAGE_NAME:latest \
--push .
56 changes: 56 additions & 0 deletions .github/workflows/multiplatform_docker_build_dockerhub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Multi-Platform Docker Build for Dockerhub

on:
workflow_dispatch:

jobs:
build-and-publish:
runs-on: ubuntu-latest

steps:
# Step 1: Check out the repository and submodules
- name: Check out code
uses: actions/checkout@v3
with:
submodules: true # Fetch submodules
fetch-depth: 0 # Ensure the full history is fetched

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

# Step 3: Install yq
- name: Install yq
run: |
sudo apt-get update && sudo apt-get install -y wget
sudo wget https://github.com/mikefarah/yq/releases/download/v4.35.1/yq_linux_amd64 -O /usr/bin/yq
sudo chmod +x /usr/bin/yq
# Step 4: Extract component-version and component-name from odtp.yml
- name: Extract component-version and component-name
id: extract_info
run: |
VERSION=$(yq e '.component-version' odtp.yml)
NAME=$(yq e '.component-name' odtp.yml)
echo "VERSION=${VERSION}"
echo "NAME=${NAME}"
echo "COMPONENT_VERSION=${VERSION}" >> $GITHUB_ENV
echo "COMPONENT_NAME=${NAME}" >> $GITHUB_ENV
# Step 5: Log in to Docker Hub
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

# Step 6: Build and push Docker image for multiple platforms
- name: Build and push Docker image
run: |
IMAGE_NAME=${{ secrets.DOCKER_USERNAME }}/${{ env.COMPONENT_NAME }}
docker buildx build \
--platform linux/amd64,linux/arm64 \
--build-arg COMPONENT_VERSION=${{ env.COMPONENT_VERSION }} \
-t $IMAGE_NAME:${{ env.COMPONENT_VERSION }} \
-t $IMAGE_NAME:latest \
--push .
20 changes: 20 additions & 0 deletions .github/workflows/push_to_hf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Sync to Hugging Face hub
on:
push:
branches: [main]
# to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
sync-to-hub:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
lfs: true
- name: Push to hub
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
HF_USERNAME: ${{secrets.HF_USERNAME}}
run: git push --force https://$HF_USERNAME:[email protected]/spaces/katospiegel/odtp-pyannote-whisper main
50 changes: 31 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
FROM nvidia/cuda:12.1.0-devel-ubuntu22.04

# Set environment variable to avoid interactive prompts
ENV DEBIAN_FRONTEND=noninteractive

# Weasyprint is necessary for pdf printing
RUN apt-get update && apt-get install -y apt-utils weasyprint
RUN apt-get update && apt-get install -y apt-utils

RUN apt-get install -y python3.11 python3.11-venv python3-pip

COPY odtp-component-client/requirements.txt /tmp/odtp.requirements.txt
RUN pip install -r /tmp/odtp.requirements.txt
# Create directories and set permissions before switching to the non-root user
RUN mkdir -p /odtp/odtp-tmp \
/odtp \
/odtp/odtp-config \
/odtp/odtp-app \
/odtp/odtp-component-client \
/odtp/odtp-logs \
/odtp/odtp-input \
/odtp/odtp-workdir \
/odtp/odtp-output \
/home/user && \
chown -R 1000:1000 /odtp /home/user


COPY odtp-component-client/requirements.txt /odtp/odtp-tmp/odtp.requirements.txt
RUN pip install -r /odtp/odtp-tmp/odtp.requirements.txt

#######################################################################
# PLEASE INSTALL HERE ALL SYSTEM DEPENDENCIES RELATED TO YOUR TOOL
Expand All @@ -23,14 +32,16 @@ RUN pip install -r /tmp/requirements.txt
# Dependencies

RUN apt-get update && \
apt-get install -y zip git && \
apt-get install -y zip git libglib2.0-0 libpango1.0-0 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# ffmpeg
COPY --link --from=mwader/static-ffmpeg:6.1.1 /ffmpeg /usr/local/bin/
COPY --link --from=mwader/static-ffmpeg:6.1.1 /ffprobe /usr/local/bin/

# Adjust permissions so user 1000 can access /usr/local/bin
RUN chown -R 1000:1000 /usr/local/bin/

######################################################################
# ODTP COMPONENT CONFIGURATION.
Expand All @@ -41,18 +52,12 @@ COPY --link --from=mwader/static-ffmpeg:6.1.1 /ffprobe /usr/local/bin/
# ODTP Preparation
##################################################

RUN mkdir /odtp \
/odtp/odtp-config \
/odtp/odtp-app \
/odtp/odtp-component-client \
/odtp/odtp-logs \
/odtp/odtp-input \
/odtp/odtp-workdir \
/odtp/odtp-output
# Switch to the "user" user
USER 1000

# This last 2 folders are specific from odtp-eqasim
RUN mkdir /odtp/odtp-workdir/cache \
/odtp/odtp-workdir/output
# Set home to the user's home directory
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH

# This copy all the information for running the ODTP component
COPY odtp.yml /odtp/odtp-config/odtp.yml
Expand All @@ -66,8 +71,15 @@ WORKDIR /odtp
# Fix for end of the line issue on Windows
##################################################

# Switch back to root user to run sed command
USER root
RUN chown -R 1000:1000 /odtp

# Switch back to the "user" user
USER 1000
# Fix for end of the line issue on Windows. Avoid error when building on windows
RUN find /odtp -type f -iname "*.sh" -exec sed -i 's/\r$//' {} \;

EXPOSE 7860

ENTRYPOINT ["bash", "/odtp/odtp-component-client/startup.sh"]
Loading

0 comments on commit c72eec6

Please sign in to comment.