FROM golang:latest
LABEL author="VulnCheck"
LABEL website="https://vulncheck.com"

# Install java in the container. I think ideally this would be 8 but Debian removed old versions (probably correctly)
RUN apt-get update && \
    apt-get -y install \
    openjdk-17-jdk

# build the binary in a subdirectory
WORKDIR /vulncheck

# add all Go files
COPY *.go ./

# add go.sum and go.mod
COPY go.* ./

# add java file to compile
COPY *.java ./

# add java libs
COPY ./lib/* ./lib/

# add the Makefile
COPY Makefile .

# change working directory and compile
RUN make compile

# mv the compiled binary to a generic name because our generic makefile appends arch info
RUN mv ./build/* ./exploit

# exec <3
ENTRYPOINT ["/vulncheck/exploit"]
