# https://hub.docker.com/_/alpine
ARG alpine_ver=3.18
FROM alpine:${alpine_ver}

ARG build_rev=0

# ARG SSH_PRIVATE_KEY
# ARG REMOTE_HOST

# Install Rsync and SSH.
RUN apk update \
    && apk upgrade \
    && apk add --no-cache \
    rsync \
    bash \
    openssh-client-default \
    sshpass \
    nodejs-current \
    npm \
    ca-certificates tzdata \
    && update-ca-certificates \
    && rm -rf /var/cache/apk/*

# RUN addgroup -S node && adduser -S node -G node

# USER node

# RUN mkdir /home/node/.ssh



RUN mkdir sprattle

# RUN mkdir -p -m 0700 /home/node/.ssh && ssh-keyscan $REMOTE_HOST >> /home/node/.ssh/known_hosts

# RUN chown -R node:node /home/node/.ssh

WORKDIR /sprattle


COPY package*.json ./
COPY . .

RUN ls -la

RUN npm install 
# COPY --chown=node:node . .

CMD ["node", "srv.js"]