FROM ubuntu:latest

# Install dependencies
RUN apt-get update && \
    apt-get install -y \
    golang-go \
    git \
    build-essential \
    curl \
    vim \
    wget \
    && apt-get clean

# Set environment variables for Go
ENV GOPATH=/go
ENV PATH=$GOPATH/bin:/usr/local/go/bin:$PATH

# Install stringer and other required tools
RUN go install golang.org/x/tools/cmd/stringer@latest && \
    go install github.com/blynn/nex@latest && \
    go install golang.org/x/tools/cmd/goyacc@latest

# Install mgmt
RUN git clone https://github.com/purpleidea/mgmt.git /mgmt && \
    cd /mgmt && \
    make deps && \
    make

RUN mv ./mgmt /usr/bin

WORKDIR /workspace