FROM python:python:3.11-bullseye

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    curl \
    git \
    nodejs \
    npm \
    vim

RUN curl -fsSL https://code-server.dev/install.sh | sh
RUN code-server \
    --install-extension ms-python.python \
    --install-extension ms-toolsai.jupyter \
    --install-extension eamodio.gitlens \
    --install-extension mtxr.sqltools \
    --install-extension mtxr.sqltools-driver-mysql

RUN curl -sSL https://install.python-poetry.org | python3 - && \
    ln -s /root/.local/bin/poetry /usr/local/bin/poetry

RUN mkdir -p /workspace

WORKDIR /workspace

RUN mkdir -p ~/.config/code-server && \
    echo "bind-addr: 0.0.0.0:8080\nauth: none\ncert: false" > ~/.config/code-server/config.yaml

EXPOSE 8080

CMD ["code-server" "--host" "0.0.0.0" "--port" "8080"]
