FROM pipdevs/ts-dev:3.6.2

# Install python
RUN apk add --update \
    python \
    python-dev \
    py-pip \
    build-base \
  && pip install virtualenv \
  && rm -rf /var/cache/apk/*

# Install git and ssh
RUN apk update && apk add git && apk add openssh

# Copy local ssh keys
COPY docker/id_rsa /root/.ssh/

# Setup ssh access to github repositories
RUN chmod 600 /root/.ssh/id_rsa* \
    && ssh-keyscan github.com >> ~/.ssh/known_hosts \
    && ssh-keyscan gitlab.com >> ~/.ssh/known_hosts 

# Set working directory
WORKDIR /app

# Copy project file
COPY package.json .

# Install ALL node_modules, including 'devDependencies'
RUN npm install

# Copy entire project
COPY . .

# Build protoc
# RUN protoc \
#     --plugin="protoc-gen-ts=./node_modules/.bin/protoc-gen-ts" \
#     --js_out="import_style=commonjs,binary:./generated" \
#     --ts_out="service=true:./generated" \
#     src/protos/party_activities_v1.proto

# Compile source in typescript
RUN tsc