FROM alpine:latest

RUN apk add --upgrade --no-cache \
  bash \
  curl \
  git \
  grep \
  openssh-client \
  py3-requests \
  skopeo \
  util-linux

RUN mkdir -p ~./local/bin
RUN mkdir -p ~/.abra/apps
RUN mkdir -p ~/.abra/vendor
RUN mkdir -p ~/.ssh/

RUN ssh-keyscan -p 2222 git.autonomic.zone > ~/.ssh/known_hosts

RUN curl -L https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 --output ~/.abra/vendor/jq
RUN chmod +x ~/.abra/vendor/jq

RUN curl -L https://github.com/mikefarah/yq/releases/download/v4.9.3/yq_linux_amd64 --output ~/.abra/vendor/yq
RUN chmod +x ~/.abra/vendor/yq

# Note(decentral1se): it is fine to always use the development branch because
# our Drone CI docker auto-tagger will publish official release tags and
# otherwise give us the latest abra on the latest tag
RUN curl https://install.abra.coopcloud.tech | bash -s -- --dev

COPY bin/* /root/.local/bin/

ENTRYPOINT ["/root/.local/bin/abra"]