FROM rhosp14/openstack-cinder-base:14.0-125

LABEL com.redhat.component="ember-csi-container" \
      name="cnv-tech-preview/ember-csi" \
      version="v1.4.1" \
      summary="Ember CSI  container" \
      io.k8s.display-name="ember-csi" \
      maintainer="Christian Schwede <cschwede@redhat.com>" \
      description="Ember CSI  container for CNV"

RUN mkdir /sources
COPY *.tar.gz *.whl *.rpm /sources/

RUN yum -y install xfsprogs e2fsprogs btrfs-progs nmap-ncat /sources/*.rpm && \
    mkdir -p /var/lib/ember-csi/{vols,locks} && \
    touch /var/lib/ember-csi/ssh_known_hosts && \
    yum clean all && \
    rm -rf /var/cache/yum

RUN yum update -y && yum clean all && rm -rf /var/cache/yum

# Install all required dependencies
RUN pip2 install --no-cache-dir --upgrade /sources/PyYAML-3.13.tar.gz
RUN pip2 install --no-cache-dir /sources/*.whl

RUN pip2 install --no-cache-dir /sources/cinderlib-master.tar.gz
RUN pip2 install --no-cache-dir /sources/ember-csi-master.tar.gz

RUN rm -rf /sources

RUN yum -y remove python2-pip && \
    yum clean all && \
    rm -rf /var/cache/yum

# This is the default port, but if we change it via CSI_ENDPOINT then this will
# no longer be relevant.
# For the Master version expose RPDB port to support remote debugging
EXPOSE 50051 4444

# Enable RPDB debugging on this container by default
ENV X_CSI_DEBUG_MODE=rpdb

# Define default command
CMD ["ember-csi"]
