# ArchLinux base
FROM archlinux:base

ARG RELEASE_VERSION

# WORKAROUND for glibc 2.33 and old Docker
# See https://github.com/actions/virtual-environments/issues/2658
# Thanks to https://github.com/lxqt/lxqt-panel/pull/1562
RUN patched_glibc=glibc-linux4-2.33-4-x86_64.pkg.tar.zst && \
    curl -LO "https://repo.archlinuxcn.org/x86_64/$patched_glibc" && \
    bsdtar -C / -xvf "$patched_glibc"

RUN ["/bin/bash", "-c", "pacman --noconfirm -Sy gcc ffmpeg espeak &&\
    pacman --noconfirm -Sy libsndfile &&\
    pacman --noconfirm -Sy libnsl &&\
    pacman --noconfirm -Syu python python-pip &&\
    ln -s /usr/lib/libffi.so.7 /usr/lib/libffi.so.6 &&\
    python -m pip install wheel &&\
    python -m pip install 'subaligner[harmony]==${RELEASE_VERSION:1}'"]