# Dockerfile for https://github.com/adnanh/webhook
FROM        golang:alpine3.13 AS build
MAINTAINER  Almir Dzinovic <almir@dzinovic.net>
WORKDIR     /go/src/github.com/adnanh/webhook
ENV         WEBHOOK_VERSION 2.8.0
RUN         apk add --update -t build-deps curl libc-dev gcc libgcc
RUN         curl -L --silent -o webhook.tar.gz https://github.com/adnanh/webhook/archive/${WEBHOOK_VERSION}.tar.gz && \
  tar -xzf webhook.tar.gz --strip 1 &&  \
  go get -d && \
  go build -o /usr/local/bin/webhook && \
  apk del --purge build-deps && \
  rm -rf /var/cache/apk/* && \
  rm -rf /go

#iputils-ping \
# install \
#jinja2 \
FROM alpine:3.13
RUN apk add --update \
  bash \
  vim \
  git \
  openssh \
  curl \
  jq \
  python3 && \
  pip3 install jinja2 && \
  curl -fSL https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl -o /usr/local/bin/kubectl && \
  chmod +x /usr/local/bin/kubectl
COPY        --from=build /usr/local/bin/webhook /usr/local/bin/webhook
WORKDIR     /etc/webhook
VOLUME      ["/etc/webhook"]
EXPOSE      9000
ENTRYPOINT  ["/usr/local/bin/webhook"]
