nick_hamlin
12/20/2022, 7:10 PMARG MELTANO_IMAGE=meltano/meltano:latest
FROM $MELTANO_IMAGE
WORKDIR /project
# Install any additional requirements
COPY ./requirements.txt .
RUN pip install -r requirements.txt
# Copy over Meltano project directory
COPY . .
RUN meltano install
# Don't allow changes to containerized project files
ENV MELTANO_PROJECT_READONLY 1
# Expose default port used by `meltano ui`
EXPOSE 5000
ENTRYPOINT ["meltano"]
The meltano install
line needs meltano.yml
(and any other yml files if they’ve been broken out) to know which plugins to install, and so the line before it copies all those files into the image. This means that if one makes a change to meltano.yml
, like changing the `select`ed fields for a particular tap, the image will fully reinstall all the plugins when the container is rebuilt. This can really slow down the iteration process, so I’m wondering if there’s a way to refactor this dockerfile to avoid that.
For example, might there be a way to get meltano install
to run based on a single yml file that gets copied in first, then restructure some other yml files that capture all the field level configuration so that we can take more mindful advantage of the image layers? Any ideas/suggestions from others who have run into this?visch
12/20/2022, 7:23 PMjacob_matson
12/20/2022, 7:29 PMjacob_matson
12/20/2022, 7:29 PMnick_hamlin
12/20/2022, 7:31 PMmeltano install
type commands explicitly in your dockerfile you’ve moved the installation steps into Makefiles and have the docker file run those as you need them?jacob_matson
12/20/2022, 7:31 PMnick_hamlin
12/20/2022, 7:32 PMjacob_matson
12/20/2022, 7:33 PMjacob_matson
12/20/2022, 7:33 PMnick_hamlin
12/20/2022, 7:40 PMnick_hamlin
12/20/2022, 7:43 PMvisch
12/20/2022, 7:43 PMmeltano install tap-1
tap...N, simple easy fix I like itjacob_matson
12/20/2022, 7:44 PMjacob_matson
12/20/2022, 7:44 PMnick_hamlin
12/20/2022, 7:47 PMmeltano install
, then explicitly install all the taps separately, THEN copy over the yaml files for the taps after they’ve been installed so that they’re added in a downstream layernick_hamlin
12/20/2022, 7:47 PMmeltano install
would know where to find them without the yaml files in place, but I bet I could refactor how those yaml files are organized to deal with thatvisch
12/20/2022, 7:48 PMpip
that could be used 🤷visch
12/20/2022, 7:56 PMvisch
12/20/2022, 7:57 PMnick_hamlin
12/20/2022, 7:58 PMnick_hamlin
12/20/2022, 7:59 PMnick_hamlin
12/21/2022, 3:19 PMmeltano_install.yml
) that only lists out the plugins I care about and their corresponding `pip_url`s, I can then do this in my dockerfile:
COPY ./meltano_install.yml ./meltano.yml
RUN meltano install
COPY . .
nick_hamlin
12/21/2022, 3:21 PMmeltano install
command to find everything it needs and to cache the installed results as a layer in the image before the next layer puts the actual meltano.yml
file plus others where they need to be. I can then tinker with those files as much as I want without needing to reinstall anything.nick_hamlin
12/21/2022, 3:22 PMmeltano_install.yml
and meltano.yml
. It also generally feels a little “clever in a bad way”, but it’s a startjacob_matson
12/21/2022, 3:25 PMnick_hamlin
12/21/2022, 3:29 PMnick_hamlin
12/21/2022, 3:30 PMsteve_clarke
12/22/2022, 12:41 AM