# Start with the migration image so we can set up the DB first
FROM eventbus/db-migrations:latest 

WORKDIR /go/src/code.justin.tv/eventbus/controlplane

RUN echo "Fetching wait-for-it"
RUN curl -s -o /wait-for-it.sh https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh && chmod 777 /wait-for-it.sh

COPY . .

RUN echo "Waiting for API to start"
ENTRYPOINT [ "/wait-for-it.sh", "e2e-httpserver:8888", "--timeout=60", "--strict", "--" ]
