FROM node:16.16-alpine

WORKDIR /home/dtp/live/dtp-base
ENV NODE_ENV=production

# Populate git deploy keys
COPY docker/.ssh /root/.ssh
RUN  chown -R root:root /root/.ssh
RUN  chmod go-rwx /root/.ssh
RUN  chmod 644 /root/.ssh/config
RUN  chmod 600 /root/.ssh/id_rsa

# Install system dependencies
RUN apk update
RUN apk add ffmpeg git openrc openssh

# Populate Node.js application
COPY package.json yarn.lock ./
RUN yarn

COPY . .