FROM docker.pkgs.xarth.tv/awsi/bionic/go1.16.7:latest

# Set Up GoPath
RUN mkdir -p /go/src \
  && mkdir -p /go/bin \
  && mkdir -p /go/pkg
ENV GOPATH=/go
ENV PATH=$GOPATH/bin:$PATH

# Create folder for app code and move the files into it
RUN mkdir -p $GOPATH/src/code.justin.tv/qe/grid_router
ADD . $GOPATH/src/code.justin.tv/qe/grid_router

# Set the working directory to the source code folder
WORKDIR $GOPATH/src/code.justin.tv/qe/grid_router/src

# Build the app
RUN go build -o grid_router .

EXPOSE 8080

# When container is started, run the app
CMD ["/go/src/code.justin.tv/qe/grid_router/src/grid_router"]
