ARG MELTANO_BASE_IMAGE=python:3.8.12-slim-bullseye
FROM $MELTANO_BASE_IMAGE

ENV NODE_VERSION 10

RUN echo "Installing system deps" \
    && apt-get update \
    && apt-get install -y build-essential \
	&& apt-get install -y curl \
	&& apt-get install -y git \
    && rm -rf /var/lib/apt/lists/*

RUN echo "Installing node and yarn" \
    && curl -sS "https://deb.nodesource.com/setup_${NODE_VERSION}.x" | bash - \
    && curl -sS "https://dl.yarnpkg.com/debian/pubkey.gpg" | apt-key add - \
    && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \
    && apt-get update \
    && apt-get install -y nodejs yarn \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /build

# meltano core deps
COPY pyproject.toml .
COPY poetry.lock .
RUN pip install poetry && poetry install

ENTRYPOINT ["python"]
