
#### SHARED DOCKER STAGES ##############


# The OS setup
FROM ubuntu as developer-os
ENV DEBIAN_FRONTEND    noninteractive
RUN apt-get update --fix-missing && \
apt-get install -y software-properties-common && \
apt-get install -y --no-install-recommends apt-utils && \
apt-get install -y curl \
wget
RUN echo "export SERVER_IP_ADDRESS='0.0.0.0'" >> /etc/profile
RUN apt-get clean

# Setup for node.js
FROM developer-os as nodeenv

WORKDIR /var/www/node
RUN curl -sL https://deb.nodesource.com/setup_13.x && \
apt-get install -y nodejs npm && \
npm install -g npm && \
npm install -g npx --force
RUN npm install -g package-json-merge && \
npm install -g nodemon
RUN apt-get clean

#### THE WEB SERVICE ##############

FROM nodeenv as webservice
EXPOSE 1339
WORKDIR /var/www/node
ENTRYPOINT ["npm", "run", "start"]


