diff --git a/Dockerfile b/Dockerfile index 7a14b63..345b266 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,35 @@ -FROM python:3-alpine - +FROM python:3-alpine AS source ARG VERSION=7.1 +WORKDIR /app +RUN apk add --no-cache git +RUN git clone --recurse-submodules https://github.com/azlux/botamusique.git . && git checkout $VERSION + +FROM python:3-alpine AS python-builder WORKDIR /app +COPY --from=source /app . +RUN apk add --no-cache ffmpeg-dev gcc git jpeg-dev musl-dev opus-dev zlib-dev +RUN python3 -m venv venv \ + && venv/bin/pip install wheel opuslib protobuf \ + && venv/bin/pip install -r requirements.txt +RUN chmod +x entrypoint.sh + + +FROM node:14-alpine AS node-builder +WORKDIR /app/web +COPY --from=source /app/web . +RUN npm install \ + && npm run build -RUN apk add --no-cache git ffmpeg-dev zlib-dev jpeg-dev gcc musl-dev -RUN git clone --recurse-submodules https://github.com/azlux/botamusique.git . && git checkout $VERSION -RUN cp web/templates/index.template.html web/templates/index.en_US.html -RUN python3 -m venv venv -RUN venv/bin/pip install wheel opuslib protobuf -RUN venv/bin/pip install -r requirements.txt FROM python:3-alpine +ENV BAM_CONFIG_file="/app/configuration.ini" +ENV BAM_CERTIFICATE="/app/botamusique.pem" WORKDIR /app -COPY --from=0 /app . -RUN apk add --no-cache gcc opus-dev libmagic ffmpeg -ENTRYPOINT ["/app/venv/bin/python", "/app/mumbleBot.py"] +COPY --from=python-builder /app . +COPY --from=node-builder /app/static static +COPY --from=node-builder /app/templates templates +RUN apk add --no-cache bash libmagic ffmpeg +RUN venv/bin/python scripts/translate_templates.py --lang-dir /app/lang --template-dir /app/templates +ENTRYPOINT [ "/app/entrypoint.sh" ] +CMD ["/app/venv/bin/python", "/app/mumbleBot.py"]