-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (39 loc) · 1.64 KB
/
Dockerfile
File metadata and controls
47 lines (39 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# 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-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 . $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
# 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 \
&& . $APPHOME/venv/bin/activate \
&& python3 -m pip install -e .
FROM runtime
COPY --from=build $APPHOME $APPHOME
WORKDIR $APPHOME
ENV VIRTUAL_ENV=$APPHOME/venv
ENV PATH=$VIRTUAL_ENV/bin:$PATH
ENV PORT=8000
ENV ORIGIN=http://localhost:4200
EXPOSE $PORT
CMD gunicorn -w 4 -k uvicorn.workers.UvicornWorker readalongs.web_api:web_api_app --bind 0.0.0.0:$PORT