FROM node:10-alpine
WORKDIR /comms

# Settings
EXPOSE 80
ENV HTTP_PORT 80
ENV MONGO_URL mongodb://localhost:27017
ENV REDIS_URL redis://localhost
ENV APP_FOLDER /comms/dist/communication-app

# Dependencies
COPY package.json package-lock.json ./
RUN apk add --no-cache --virtual .gyp \
    python \
    make \
    g++ \
&& npm install --only=production --build-from-source=bcrypt \
&& apk del .gyp

# Application
STOPSIGNAL SIGINT
COPY dist/ ./dist/
CMD ["node", "dist/backend/main.js"]
