-
Notifications
You must be signed in to change notification settings - Fork 20
/
Dockerfile
38 lines (32 loc) · 1.26 KB
/
Dockerfile
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
FROM alpine:3.17.2 as runtime
ENV APPHOME /opt/readalong-studio
# Lean, optimized installation of system dependencies
RUN apk add python3 py3-numpy 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
COPY requirements*.txt $APPHOME/
RUN . $APPHOME/venv/bin/activate \
&& python3 -m pip install -r $APPHOME/requirements.txt
RUN cd $APPHOME/g2p \
&& . $APPHOME/venv/bin/activate 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
# 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
CMD gunicorn -w 4 -k uvicorn.workers.UvicornWorker readalongs.web_api:web_api_app --bind 0.0.0.0:$PORT