Build docker image for rvcv2

This commit is contained in:
Brandon Thomas
2023-07-18 04:57:28 -04:00
parent f29a7194ee
commit d6208111d8
2 changed files with 92 additions and 26 deletions
@@ -0,0 +1,65 @@
# Adapted from
# https://github.com/actions/starter-workflows/ci/docker-publish.yml
# If using base images, don't forget to add READ access, eg. from a package settings page like:
# https://github.com/orgs/storytold/packages/container/docker-base-images-rust-ssl/settings/actions_access
name: Build rvc-v2 Docker Image
on:
push:
branches:
# NB: Default-branch doesn't work, despite Github's documentation.
#- $default-branch
- master
env:
IMAGE_NAME: rvc-v2
jobs:
# Push image to GitHub Packages.
# See also https://docs.docker.com/docker-hub/builds/
push:
runs-on: ubuntu-latest
if: github.event_name == 'push'
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
#username: ${{ github.repository_owner }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image
run: cd voice_conversion/rvc-v2-brandon/ && docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"
- name: Push image to GitHub Container Registry
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "$default-branch" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
SHORT_SHA=$(echo ${GITHUB_SHA} | cut -c1-12)
docker tag $IMAGE_NAME $IMAGE_ID:$SHORT_SHA
docker push $IMAGE_ID:$SHORT_SHA
+27 -26
View File
@@ -1,31 +1,33 @@
# syntax=docker/dockerfile:1
#FROM python:3.10-bullseye
FROM nvidia/cuda:12.0.1-runtime-ubuntu22.04
FROM python:3.10-bullseye
ENV DEBIAN_FRONTEND=noninteractive
# NB: ffmpeg for transcoding opus -> wav
# NB(bt,2023-05-04): Installing lsof, htop, ripgrep, and other debugging tools
# NB(bt,2023-05-04): Installing rsync to monitor time it takes for files to sync
RUN apt-get update && apt-get install -y \
build-essential \
curl \
ffmpeg \
htop \
libsndfile1 \
lsof \
nvidia-driver-515 \
python3-pip \
python3.10 \
python3.10-dev \
python3.10-venv \
ripgrep \
rsync \
vim \
wget \
--no-install-recommends \
&& apt-get clean autoclean && apt-get autoremove -y && rm -rf /var/lib/{apt,dpkg,cache,log}/
# Alternatively,
# FROM nvidia/cuda:12.0.1-runtime-ubuntu22.04
#
# ENV DEBIAN_FRONTEND=noninteractive
#
# # NB: ffmpeg for transcoding opus -> wav
# # NB(bt,2023-05-04): Installing lsof, htop, ripgrep, and other debugging tools
# # NB(bt,2023-05-04): Installing rsync to monitor time it takes for files to sync
# RUN apt-get update && apt-get install -y \
# build-essential \
# curl \
# ffmpeg \
# htop \
# libsndfile1 \
# lsof \
# nvidia-driver-515 \
# python3-pip \
# python3.10 \
# python3.10-dev \
# python3.10-venv \
# ripgrep \
# rsync \
# vim \
# wget \
# --no-install-recommends \
# && apt-get clean autoclean && apt-get autoremove -y && rm -rf /var/lib/{apt,dpkg,cache,log}/
RUN mkdir /python_install
RUN mkdir /model_code
@@ -37,7 +39,6 @@ COPY requirements.txt .
# NB: Kubernetes will copy over the venv we create here.
RUN python3 -m venv python \
&& . python/bin/activate \
&& pip install wheel \
&& pip install -r requirements.txt
# NB: The model code is uploaded next