coreos-home-server/service/slidge/Containerfile

69 lines
2.4 KiB
Docker

FROM docker.io/debian:bookworm-slim AS builder-base
RUN apt-get update -y && apt-get install -y --no-install-recommends \
ca-certificates git curl python3 python3-pip python3-venv
ENV PATH=/venv/bin:/root/.local/bin:$PATH
RUN python3 -m venv /venv && python3 -m pip install wheel
RUN curl -fL https://install.python-poetry.org | python3 -
FROM builder-base AS builder-discord
ARG VERSION=08f23519a8c7d78dfac20b790f3cbdb362a91fbc
RUN git clone https://git.sr.ht/~nicoco/slidcord /src && \
cd /src && git reset --hard ${VERSION}
RUN cd /src && poetry export --without-hashes > requirements.txt && \
python3 -m pip install --requirement requirements.txt
RUN cp -R /src/slidcord /venv/lib/python3.11/site-packages/legacy_module
FROM builder-base AS builder-skype
ARG VERSION=a08320895c054b3cfdd4876d4ca7faccf4548eec
RUN git clone https://git.sr.ht/~nicoco/skidge /src && \
cd /src && git reset --hard ${VERSION}
RUN cd /src && poetry export --without-hashes > requirements.txt && \
python3 -m pip install --requirement requirements.txt
RUN cp -R /src/skidge /venv/lib/python3.11/site-packages/legacy_module
FROM builder-base AS builder-whatsapp
RUN apt-get update -y && apt-get install -y --no-install-recommends \
golang gcc python3-dev
ENV GOBIN=/usr/bin
RUN go install github.com/go-python/gopy@latest && \
go install golang.org/x/tools/cmd/goimports@latest
RUN python3 -m pip install pybindgen
ARG VERSION=9726982fd45bb1acdfc05a1f88ee2bcf983e76e5
RUN git clone https://git.sr.ht/~nicoco/slidge-whatsapp /src && \
cd /src && git reset --hard ${VERSION}
RUN cd /src && poetry export --without-hashes > requirements.txt && \
python3 -m pip install --requirement requirements.txt
RUN cd /src/slidge_whatsapp && gopy build -vm=python3 -output=generated -no-make=true .
RUN cp -R /src/slidge_whatsapp /venv/lib/python3.11/site-packages/legacy_module
FROM docker.io/debian:bookworm-slim
ENV PYTHONUNBUFFERED=1
ENV SLIDGE_LEGACY_MODULE=legacy_module
RUN apt-get update -y && apt-get install -y --no-install-recommends \
ca-certificates python3 libpython3.11 python3-gdbm libidn12 libmagic1 media-types shared-mime-info \
ffmpeg
RUN addgroup --system --gid 10000 slidge
RUN adduser --system --uid 10000 --ingroup slidge --home /var/lib/slidge slidge
COPY --from=builder-discord /venv /venv/discord
COPY --from=builder-skype /venv /venv/skype
COPY --from=builder-whatsapp /venv /venv/whatsapp
USER slidge