ARG PYTHON_IMAGE=python:3.11.10-slim-bookworm

FROM ${PYTHON_IMAGE}

RUN pip install --upgrade pip==24.2

ARG APP=/usr/src/app

RUN apt-get update \
    && apt-get install -y ca-certificates wget curl git jq unzip build-essential unixodbc xmlsec1  software-properties-common \
    && rm -rf /var/lib/apt/lists/*

RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - 
RUN apt-get -y update && apt-get install -y curl procps nodejs awscli

ENV TZ=Etc/UTC

RUN /usr/local/bin/python3 -m pip install pip-tools
# Install UV
RUN curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/0.5.15/uv-installer.sh | sh && mv /root/.local/bin/uv /usr/local/bin/uv

COPY --from=oven/bun:1.1.40 /usr/local/bin/bun /usr/bin/bun

# add the docker client to call docker from a worker if enabled
COPY --from=docker:dind /usr/local/bin/docker /usr/local/bin/

WORKDIR ${APP}

COPY --from=ghcr.io/windmill-labs/windmill-ee:dev --chmod=755  ${APP}/windmill ${APP}/windmill

RUN ln -s ${APP}/windmill /usr/local/bin/windmill

COPY ./frontend/src/lib/hubPaths.json ${APP}/hubPaths.json

RUN windmill cache ${APP}/hubPaths.json

RUN rm ${APP}/hubPaths.json

EXPOSE 8000

CMD ["windmill"]
