FROM ubuntu:16.04

ENV DEBIAN_FRONTEND noninteractive

ENV LANG C.UTF-8

ENV GOROOT /usr/local/go

ENV GOPATH /usr/local

ENV PATH $GOPATH/bin:$GOROOT/bin:$PATH

WORKDIR /mint

RUN apt-get --yes update && apt-get --yes upgrade && \
    apt-get --yes --quiet install wget jq curl dnsmasq

ENV MINT_ROOT_DIR /mint
ENV MINT_RUN_CORE_DIR $MINT_ROOT_DIR/run/core
ENV MINT_RUN_SECURITY_DIR $MINT_ROOT_DIR/run/security
ENV WGET "wget --quiet --no-check-certificate"

COPY create-data-files.sh /mint
RUN /mint/create-data-files.sh

COPY install-packages.list /mint
COPY preinstall.sh /mint
RUN /mint/preinstall.sh

COPY run /mint/run

COPY build/awscli /mint/build/awscli
RUN build/awscli/install.sh

COPY build/aws-sdk-java /mint/build/aws-sdk-java
RUN build/aws-sdk-java/install.sh

COPY build/aws-sdk-go /mint/build/aws-sdk-go
RUN build/aws-sdk-go/install.sh

COPY build/aws-sdk-php /mint/build/aws-sdk-php
RUN build/aws-sdk-php/install.sh

COPY build/aws-sdk-ruby /mint/build/aws-sdk-ruby
RUN build/aws-sdk-ruby/install.sh

COPY build/mc /mint/build/mc
RUN build/mc/install.sh

COPY build/minio-go /mint/build/minio-go
RUN build/minio-go/install.sh

COPY build/minio-java /mint/build/minio-java
RUN build/minio-java/install.sh

COPY build/minio-js /mint/build/minio-js
RUN build/minio-js/install.sh

COPY build/minio-py /mint/build/minio-py
RUN build/minio-py/install.sh

COPY build/s3cmd /mint/build/s3cmd
RUN build/s3cmd/install.sh

COPY build/minio-dotnet/ /mint/build/minio-dotnet/
RUN /mint/build/minio-dotnet/install.sh

COPY build/security /mint/build/security
RUN build/security/install.sh

COPY build/worm /mint/build/worm
RUN build/worm/install.sh

COPY build/healthcheck /mint/build/healthcheck
RUN build/healthcheck/install.sh

COPY remove-packages.list /mint
COPY postinstall.sh /mint
RUN /mint/postinstall.sh

COPY mint.sh /mint/mint.sh
COPY entrypoint.sh /mint/entrypoint.sh

ENTRYPOINT ["/mint/entrypoint.sh"]
