# Base image to build from
FROM debian:stretch

# Image maintainer and information.
LABEL vendor="TRG" \
    maintainer="ronbravo1701@gmail.com" \
    description="The TRG development environment." \
    com.kubra.version="0.0.1-beta" \
    com.kubra.release="2018-02-06"

# Install the dependencies needed for the
# application to run.

# Install OS dependencies.
RUN apt-get update && apt-get install -y \
    curl \
    gnupg \
    build-essential \
    apt-transport-https

# Install Node JS.
# RUN curl -sL https://deb.nodesource.com/setup_6.x | bash
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash
RUN apt-get install -y nodejs
RUN npm install -g n \
RUN node -v \
    npm -v \
    n 8.9.1

# Install Arango DB.
RUN curl -OL https://www.arangodb.com/9c169fe900ff79790395784287bfa82f0dc0059375a34a2881b9b745c8efd42e/arangodb33/Debian_9.0/Release.key
RUN apt-key add - < Release.key

RUN echo 'deb https://www.arangodb.com/9c169fe900ff79790395784287bfa82f0dc0059375a34a2881b9b745c8efd42e/arangodb33/Debian_9.0/ /' | tee /etc/apt/sources.list.d/arangodb.list
# RUN sudo apt-get install apt-transport-https
RUN apt-get update
RUN apt-get install arangodb3e=3.3.3

# Install Node packages.
RUN npm install http-server -g

# Copy over the application from the local
# directory to the docker image.
COPY /myapp /opt/myapp

# Change the working directory of the image
# to where the application was copied to.
WORKDIR /opt/myapp

CMD ["ls", "-la", "/ronbravo/project"]

# Run the docker container.
# This is the command that will run by
# default by the image.
# ENTRYPOINT ["http-server", "/opt/myapp"]

# Expose ports.
# The nodejs http-server runs on port 8080 by
# default in the container. So that is the
# port that we need to expose. Then when running
# container you can map it to the docker command
#
# ex:
#   docker run -p 3501:8080 <docker-name>
#
# This maps the host's port 3501 to the exposed
# docker container's port of 8080.

EXPOSE 8080



# ENTRYPOINT ["node", "test.js"]
# Define default command.
# CMD ["http-server"]

# Expose ports.
# EXPOSE 8080
#EXPOSE 443

# - How to mount a drive from the host.
# docker run -v "/Users/ronbravo/project:/ronbravo/project" bravo

# docker run -p 3500:8080 bravo
# docker build -t ronbravo/simple-node-server .; printf "\n\n---------\nRUN DOCKER\n"; docker run ronbravo/simple-node-server


# ENTRYPOINT ["http-server", "/opt/myapp", "-a", "0.0.0.0"]
# EXPOSE 3500

# ENTRYPOINT ["ls", "--help"]
# CMD ["-la"]

# CMD ['ls']

# CMD ['npm'];

# CMD ['npm']

# ENTRYPOINT ['npm -v']
# CMD ['--help']


# RUN apt-get update && apt-get install -y \
#     git \
#     build-essential \
#     make \
#     gcc \
#     sudo
#
# RUN curl -sL https://deb.nodesource.com/setup_6.x \
#     apt-get install -y nodejs

# RUN apt-get update && apt-get install -y \
#     curl \
#     curl -sL https://deb.nodesource.com/setup_4.x | bash \
#     nodejs \
#     node -v \
#     npm -v

# RUN apt-get update
# RUN apt-get -qq update
# RUN apt-get install -y nodejs npm

# RUN apt-get update && apt-get install -y \
#     apt-get install -y gnupg \
#     apt-get install -y curl \
#     curl -sL https://deb.nodesource.com/setup_6.x | bash \
#     apt-get install -y nodejs \
#     node -v \
#     npm -v \
#     npm install -g n \
#     n 6.11.2

# RUN apt-get update && apt-get install -y \
#     regex
    # glob \
    # regex \
    # curl -s https://deb.nodesource.com/setup_6.x | bash
