FROM centos:7

# Docker build arguments
ARG SOURCE_DIR=/jellyfin
ARG ARTIFACT_DIR=/dist

# Docker run environment
ENV SOURCE_DIR=/jellyfin
ENV ARTIFACT_DIR=/dist
ENV IS_DOCKER=YES

# Prepare CentOS environment
RUN yum update -y \
  && yum install -y epel-release \
  && yum install -y @buildsys-build rpmdevtools git yum-plugins-core nodejs-yarn autoconf automake glibc-devel

# Install recent NodeJS and Yarn
RUN curl -fSsLo /etc/yum.repos.d/yarn.repo https://dl.yarnpkg.com/rpm/yarn.repo \
  && rpm -i https://rpm.nodesource.com/pub_10.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm \
  && yum install -y yarn

# Link to build script
RUN ln -sf ${SOURCE_DIR}/deployment/build.centos /build.sh

VOLUME ${SOURCE_DIR}

VOLUME ${ARTIFACT_DIR}

ENTRYPOINT ["/build.sh"]
