FROM stashapp/stash:latest as binary

FROM ubuntu:22.04

COPY --from=binary /usr/bin/stash /usr/bin/stash
#RUN apk add --no-cache ca-certificates python3 py3-requests py3-requests-toolbelt py3-lxml py3-pip ffmpeg vips-tools ruby  \
#    && pip install --no-cache-dir mechanicalsoup cloudscraper  \
#    && gem install faraday

RUN apt-get update && apt-get install -y \
    ca-certificates \
    python3 \
    python3-requests \
    python3-requests-toolbelt \
    python3-lxml \
    python3-pip \
    ffmpeg \
    libvips-tools \
    ruby \
    tcplay \
    && rm -rf /var/lib/apt/lists/* \
    && pip install --no-cache-dir mechanicalsoup cloudscraper  \
    && gem install faraday


RUN ln -s /usr/bin/python3 /usr/bin/python
RUN mkdir -p /root/.stash
ENV STASH_CONFIG_FILE=/root/.stash/config.yml

COPY ./entrypoint.sh /entrypoint
RUN chmod +x /entrypoint

EXPOSE 9999
CMD ["/entrypoint"]

# Tests
RUN python --version | grep "Python 3."; \
    ruby --version | grep "ruby 3.";
