From 8f85917392899e7b7de08b6083691226250876c6 Mon Sep 17 00:00:00 2001 From: Oscar Wahltinez Date: Thu, 30 Nov 2023 22:32:22 -0800 Subject: [PATCH] Add Dockerfile and instructions for running perch in a container. PiperOrigin-RevId: 586894152 --- Dockerfile | 19 +++++++++++++++++++ README.md | 16 ++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..df394800 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM python:3.11 + +# Environment variables +ENV PIP_DISABLE_PIP_VERSION_CHECK=1 +ENV PIP_NO_CACHE_DIR=1 +ENV POETRY_VERSION=1.6.1 + +# Install poetry +RUN python -m pip install "poetry==$POETRY_VERSION" + +# Install native dependencies +RUN apt-get -y update && apt-get -y install libsndfile1 ffmpeg + +# Instal dependencies specified in the poetry configs +WORKDIR /app +ADD . /app +RUN poetry install + +ENTRYPOINT [ "/usr/local/bin/poetry", "run" ] diff --git a/README.md b/README.md index fcb47c3c..1c4e6825 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,22 @@ Running `poetry install` installs all Perch dependencies into a new virtual envi poetry run python -m unittest discover -s chirp/tests -p "*test.py" ``` +## Using a container + +Alternatively, you can install and run this project using a container via +Docker. To build a container using the tag `perch`, run: +```bash +git clone https://github.com/google-research/perch +cd perch +docker build . --tag perch +``` + +And then you can run the different commands using the container you just built. +For example, to run the tests, try: +```bash +docker run --rm -t perch python -m unittest discover -s chirp/tests -p "*test.py" +``` + ## BIRB data preparation ### Evaluation data