Andy Carter
10/25/2023, 1:47 PMdocker build process? I'm aware of the issue due to plugin installs being slower in docker, but any general suggestions.
I am starting from the stock meltano Dockerfile. My image includes ~15 plugins and my dbt models/seeds, so a one line change to a sql file can lead to a 15 min deployment time, mostly involving rebuilding the image, going through meltano install etc.
Can I make use of layers somehow? My build command is docker build --pull --rm -f "Dockerfile" -t myimg:latest "."Andy Carter
10/25/2023, 2:04 PM# <http://registry.gitlab.com/meltano/meltano:latest|registry.gitlab.com/meltano/meltano:latest> is also available in GitLab Registry
ARG MELTANO_IMAGE=meltano/meltano:v2.20.0-python3.10
FROM $MELTANO_IMAGE
WORKDIR /project
# Install any additional requirements
COPY ./requirements.txt .
RUN pip install -r requirements.txt
# Copy over Meltano project directory
COPY . .
# overwrite dagster.yaml with contents of dagster_azure.yaml
RUN rm -rf ./orchestrate/dagster/dagster.yaml
COPY ./orchestrate/dagster/dagster_azure.yaml ./orchestrate/dagster/dagster.yaml
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
# Expose port used for postgres connection
EXPOSE 5432
# Expose port used for postgres connection
EXPOSE 3000
ENTRYPOINT ["meltano"]
My dbt models get copied in the COPY . . step, but if that comes before the RUN meltano install step, then presumably a change to the models means the following steps have to be rerun?Andy Carter
10/25/2023, 2:09 PMAndy Carter
10/25/2023, 2:48 PMorchestrate directory, as this meant the meltano install step needed to be carried out with every change to my sql models. I need the models in that location for dagster to pick them up.
So I split up the COPY . . command into two steps, copying my models as the 2nd step, and placed the RUN meltano install command between the two COPY commands.
It also made a huge difference to the timing needed for docker push too, as it's only pushing the small changes to the dbt layer, not the RUN meltano install layer (which is largely unchanged anyway)
Resultant Dockerfile:
# registry.gitlab.com/meltano/meltano:latest is also available in GitLab Registry
ARG MELTANO_IMAGE=meltano/meltano:v2.20.0-python3.10
FROM $MELTANO_IMAGE
WORKDIR /project
# Install any additional requirements
COPY ./requirements.txt .
RUN pip install -r requirements.txt
COPY meltano.yml logging.yaml ga4_reports.json ./
ADD meltano-yml meltano-yml
ADD plugins plugins
# Copy over Meltano project directory
# COPY . .
RUN meltano install
# then copy dbt models in orchestrate folder
ADD orchestrate orchestrate
# overwrite dagster.yaml with contents of dagster_azure.yaml
RUN rm -rf ./orchestrate/dagster/dagster.yaml
COPY ./orchestrate/dagster/dagster_azure.yaml ./orchestrate/dagster/dagster.yaml
# Don't allow changes to containerized project files
ENV MELTANO_PROJECT_READONLY 1
# Expose default port used by `meltano ui`
EXPOSE 5000
# Expose port used for postgres connection
EXPOSE 5432
# Expose port used for postgres connection
EXPOSE 3000
ENTRYPOINT ["meltano"]Andy Carter
10/25/2023, 8:47 PMmeltano.yml and /plugins dir is there anything else I would need to copy from the project dir? Up until now it has just been COPY . . as per stock Dockerfile so have just copied everything?Will Da Silva (Arch)
10/25/2023, 11:26 PMedgar_ramirez_mondragon
10/25/2023, 11:39 PM