Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
venv
.git*
*venv*
build
26 changes: 16 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,34 @@
# Dockerfile for Readalong Studio Web API
# Build: `docker build --tag ras .`
# Run: `docker run -d -p 8000:8000 ras` for local testing, or use `-p` to map
# whichever host port you want to 8000 on the container. Set ORIGIN to the base
# URL of your Studio-Web for production deployments.

FROM alpine:latest AS runtime

ENV APPHOME=/opt/readalong-studio

# Lean, optimized installation of system dependencies
RUN apk add python3 py3-numpy py3-yaml git ffmpeg
RUN apk add python3 py3-yaml git ffmpeg

FROM runtime AS build
WORKDIR $APPHOME
RUN apk add python3-dev py3-pip gcc g++ musl-dev ninja
RUN python3 -m venv --system-site-packages $APPHOME/venv
RUN git clone https://github.com/roedoejet/g2p.git
RUN . $APPHOME/venv/bin/activate \
&& python3 -m pip install --upgrade pip
COPY requirements*.txt $APPHOME/
RUN . $APPHOME/venv/bin/activate \
&& python3 -m pip install -r $APPHOME/requirements.txt
RUN . $APPHOME/venv/bin/activate \
&& python3 -m pip install soundswallower
RUN cd $APPHOME/g2p \
&& . $APPHOME/venv/bin/activate python3 -m pip install -e .

# requirements.txt already gets g2p@main from github, no need to clone it separately
# RUN git clone --depth=1 https://github.com/NRC-ILT/g2p.git
# RUN cd $APPHOME/g2p \
# && . $APPHOME/venv/bin/activate \
# && SETUPTOOLS_SCM_PRETEND_VERSION=$(cat .SETUPTOOLS_SCM_PRETEND_VERSION) python3 -m pip install -e .

# Do this after all the above so we don't needlessly rebuild
COPY . $APPHOME/Studio
RUN cd $APPHOME/Studio \
Expand All @@ -29,13 +41,7 @@ WORKDIR $APPHOME
ENV VIRTUAL_ENV=$APPHOME/venv
ENV PATH=$VIRTUAL_ENV/bin:$PATH

# Run this container with `docker run -d -p 8000:8000` for local
# testing, or use `-p` to map whichever host port you want to 8000 on
# the container. Set ORIGIN to the base URL of your Studio-Web for
# production deployments.

ENV PORT=8000
ENV ORIGIN=http://localhost:4200
EXPOSE $PORT
SHELL ["/bin/sh", "-c"]
CMD gunicorn -w 4 -k uvicorn.workers.UvicornWorker readalongs.web_api:web_api_app --bind 0.0.0.0:$PORT
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ heroku = [
"readalongs[api]",
# We don't actually use the panphon 0.22 improvements on heroku so stick to
# 0.21 with its lighter weight dependencies
"panphon<0.22",
"ilt-panphon>=0.21.4,<0.22",
]

ci = [
Expand Down
7 changes: 2 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# - soundswallower~=0.6.0
# - webvtt-py==0.5.1
# - gunicorn>=23.0.0; platform_system != "Windows"
# - panphon<0.22
# - ilt-panphon<0.22,>=0.21.4
# - uvicorn>=0.30.1
#

Expand Down Expand Up @@ -75,7 +75,7 @@ openpyxl==3.1.5
# via g2p
packaging==25.0
# via gunicorn
ilt-panphon==0.21.3
ilt-panphon==0.21.4
# via
# hatch.envs.prod
# g2p
Expand Down Expand Up @@ -129,6 +129,3 @@ uvicorn==0.38.0
# via hatch.envs.prod
webvtt-py==0.5.1
# via hatch.envs.prod

# The following packages are considered to be unsafe in a requirements file:
# setuptools