diff --git a/Dockerfile b/Dockerfile index d3858b3..07a4d2f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,37 +1,51 @@ -FROM python:3-alpine AS source +ARG ARCH= + +FROM ${ARCH}python:3-slim-buster AS source ARG VERSION=7.1 -WORKDIR /app -RUN apk add --no-cache git +ENV DEBIAN_FRONTEND=noninteractive +WORKDIR /botamusique +RUN apt-get update && apt-get install -y 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 zlib-dev +FROM ${ARCH}python:3-slim-buster AS python-builder +ENV DEBIAN_FRONTEND=noninteractive +WORKDIR /botamusique +COPY --from=source /botamusique . +RUN apt-get update \ + && apt-get install -y gcc ffmpeg libjpeg-dev libmagic-dev opus-tools zlib1g-dev \ + && rm -rf /var/lib/apt/lists/* RUN python3 -m venv venv \ - && venv/bin/pip install wheel opuslib protobuf \ + && venv/bin/pip install wheel \ && 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 - - -FROM python:3-alpine -ENV BAM_CONFIG_file="/app/configuration.ini" -ENV BAM_CERTIFICATE="/app/botamusique.pem" -ENV BAM_DB="/data/data.db" -ENV BAM_MUSIC_DB="/data/music.db" -WORKDIR /app -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 gcc ffmpeg libmagic opus-dev -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"] +FROM ${ARCH}node:14-buster-slim AS node-builder +ENV DEBIAN_FRONTEND=noninteractive +WORKDIR /botamusique/web +COPY --from=source /botamusique/web . +RUN npm install +RUN npm run build + + +FROM ${ARCH}python:3-slim-buster AS template-builder +ENV DEBIAN_FRONTEND=noninteractive +WORKDIR /botamusique +COPY --from=python-builder /botamusique . +COPY --from=node-builder /botamusique/templates templates +RUN venv/bin/python scripts/translate_templates.py --lang-dir /botamusique/lang --template-dir /botamusique/templates + + +FROM ${ARCH}python:3-slim-buster +ENV DEBIAN_FRONTEND=noninteractive +EXPOSE 8181 +WORKDIR /botamusique +COPY --from=python-builder /botamusique . +COPY --from=node-builder /botamusique/static static +COPY --from=template-builder /botamusique/templates templates +RUN apt-get update \ + && apt-get install -y ffmpeg libmagic-dev opus-tools zlib1g \ + && rm -rf /var/lib/apt/lists/* +RUN chmod +x entrypoint.sh +ENTRYPOINT [ "/botamusique/entrypoint.sh" ] +CMD ["/botamusique/venv/bin/python", "/botamusique/mumbleBot.py"]