update dockerfile; add github action to build

This commit is contained in:
Brandon Thomas
2023-11-17 04:58:50 -05:00
parent f0947a67b7
commit b0ced14f4f
2 changed files with 81 additions and 10 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 VALL-E-X Docker Image
on:
push:
branches:
# NB: Default-branch doesn't work, despite Github's documentation.
#- $default-branch
- master
env:
IMAGE_NAME: vallex
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 tts/VALL-E-X/ && 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
+16 -10
View File
@@ -10,29 +10,35 @@ RUN apt-get update && apt-get install -y curl
RUN echo "package-name package-name/some-option select option-value" | debconf-set-selections && \
apt-get install -y software-properties-common
RUN apt install software-properties-common -y
RUN apt-get install software-properties-common -y
RUN add-apt-repository ppa:deadsnakes/ppa
RUN sudo apt-get update
RUN sudo apt-get install python3.8 python3.8-venv python3.8-dev
RUN apt-get update
RUN apt-get install -y python3.8 python3.8-venv python3.8-dev python3.8-full python3.8-distutils
#RUN apt install python3.10 -y
RUN apt-get install -y git
RUN sudo apt install ffmpeg
RUN apt-get install -y ffmpeg
RUN apt-get install -y wget
RUN wget https://bootstrap.pypa.io/get-pip.py
RUN python3.8 get-pip.py
# Clone the repository
# RUN pwd
RUN pip3 install requirements-pinned.txt
COPY requirements-pinned.txt .
RUN pip3 install -r requirements-pinned.txt
# Navigate to the cloned directory and checkout the specific commit
WORKDIR TestingDockerIO
COPY VALL-E-X .
#WORKDIR TestingDockerIO
#COPY VALL-E-X .
COPY . .
RUN git pull
RUN git reset --hard origin/main
#RUN git pull
#RUN git reset --hard origin/main
#RUN git checkout 47c491a29d10c04c6f1efd01bc7b334d11cad4f2
# # Allow parameters to be passed