mirror of
https://github.com/azlux/botamusique
synced 2024-11-23 13:56:17 +00:00
azlux
19858595d6
* Added multi-stage docker build * switch dockerfile files Co-authored-by: ReAnzu <github@reanzu.com>
52 lines
1.7 KiB
Docker
52 lines
1.7 KiB
Docker
ARG ARCH=
|
|
|
|
FROM ${ARCH}python:3-slim-buster AS source
|
|
ARG VERSION=master
|
|
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 ${ARCH}python:3-slim-buster AS python-builder
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
WORKDIR /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/*
|
|
COPY --from=source /botamusique .
|
|
RUN python3 -m venv venv \
|
|
&& venv/bin/pip install wheel \
|
|
&& venv/bin/pip install -r requirements.txt
|
|
|
|
|
|
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
|
|
RUN apt-get update \
|
|
&& apt-get install -y ffmpeg libmagic-dev opus-tools zlib1g \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
COPY --from=python-builder /botamusique .
|
|
COPY --from=node-builder /botamusique/static static
|
|
COPY --from=template-builder /botamusique/templates templates
|
|
RUN chmod +x entrypoint.sh
|
|
ENTRYPOINT [ "/botamusique/entrypoint.sh" ]
|
|
CMD ["/botamusique/venv/bin/python", "/botamusique/mumbleBot.py"]
|