FROM codercom/enterprise-base:ubuntu

ARG GO_VERSION=1.22.5
ARG GO_ARCH=amd64

USER root

RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get upgrade -y && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y \
      curl wget git sudo zip unzip jq build-essential ca-certificates && \
    rm -rf /var/lib/apt/lists/*

RUN curl -fsSL https://get.docker.com | sh

RUN curl -fsSL "https://go.dev/dl/go${GO_VERSION}.linux-${GO_ARCH}.tar.gz" -o /tmp/go.tar.gz && \
    tar -C /usr/local -xzf /tmp/go.tar.gz && \
    rm /tmp/go.tar.gz

USER coder

RUN curl -fsSL https://bun.sh/install | bash

RUN curl -s "https://get.sdkman.io" | bash && \
    bash -c "source $HOME/.sdkman/bin/sdkman-init.sh && sdk install maven"

RUN curl -fsSL https://opencode.ai/install | bash

ENV PATH="/usr/local/go/bin:/home/coder/go/bin:/home/coder/.opencode/bin:/home/coder/.bun/bin:${PATH}"
