###############
# Build Image #
###############

FROM registry.yandex.net/rtc-base/bionic:stable AS builder

RUN curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash - && apt-get install -y --force-yes nodejs	

COPY . .

RUN (\
npm ci -f --no-audit --no-progress --ignore-scripts && \
npm run build \
)

#################
# Runtime Image #
#################
FROM registry.yandex.net/rtc-base/bionic:stable

RUN curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash - && apt-get install -y --force-yes nodejs

ARG APP_DIR=/app/
WORKDIR $APP_DIR

COPY --from=builder dist ./

EXPOSE 80 3456

CMD node ./index.js
