FROM golang:1.13 AS builder

WORKDIR /go/src/app
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .

RUN make

FROM node:12.18 AS console-builder

WORKDIR /skupper-console/
ADD https://github.com/skupperproject/gilligan/archive/refs/tags/v0.6.tar.gz .
RUN tar -zxf v0.6.tar.gz
WORKDIR ./gilligan-0.6
RUN yarn install && yarn build

FROM registry.access.redhat.com/ubi8-minimal

WORKDIR /app
COPY --from=builder /go/src/app/service-controller .
COPY --from=builder /go/src/app/get /usr/local/bin/get
COPY --from=console-builder /skupper-console/gilligan-0.6/build/ console
CMD ["/app/service-controller"]
