Livepush missing required build steps during a change

Apologies if this should be in a different category.

I’m am using livepush to update a container on my device, but it is missing a required step to fully apply the changes. Here is the Dockerfile:
FROM balenalib/raspberrypi3-node:8-build AS ui-build

WORKDIR /src

RUN npm config set registry https://registry.npmjs.org/ \
&& npm install -g -s --no-progress yarn

COPY ./ui/package.json ./
RUN yarn

COPY ./ui ./
RUN yarn run build \
    && yarn cache clean

FROM balenalib/raspberrypi3-python:3.6

ENV DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket

RUN apt-get update && apt-get install -y \
    dnsmasq \
    libdbus-glib-1-dev \
    dbus \
    make \
    pkg-config \
    wireless-tools \
    gcc \
    libgirepository1.0-dev \
    libcairo2-dev \
    python3-dev \
    gir1.2-gtk-3.0 \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /src
COPY ./requirements.txt /src/requirements.txt
RUN pip3 install -r /src/requirements.txt

COPY --from=ui-build ./src/dist ./server/dist
COPY . /src/
RUN rm -rf /src/ui

CMD ["python", "app.py"]

This container uses Vue.js as the frontend and Flask as the backend. When I alter code contained in the frontend (inside of the directory ui), the only steps executed by livepush are:

  • COPY ./ui ./
  • RUN yarn ...
  • RUN rm -rf /src/ui

The missing step that is needed to bring the newly built code into the container is:

  • COPY --from=ui-build ./src/dist ./server/dist

Is there something I can change about our Dockerfile so that livepush understands to copy the resulting build from the first stage?

Hey @ejohnso49 thanks for the report, let’s get to the bottom of this.

I ran your dockerfile through the parsing routines of livepush, and it correctly detected the stage dependency, so I’m not entirely sure where the process is failing.

Could you paste the output of a running livepush please?

Also if it’s possible for you to share your entire code with me, that would be amazing.

Hi Cameron,

Sorry for the delay getting back to you. I did a few experiments today with livepush and I logged the output from this. I made a change to my code and ran balena push, this change was reflected correctly when I ran my test. Then I made another change while the livepush was still running but in this case I did not see that reflected in my test. I will send you the output from this. Thank you for the help

Thanks for sending that over @ejohnso49

What’s interesting is that the commands from the second stage definitely get executed, so it will have at least attempted to perform the copy too.

Can you take a look at the source tree of the container, and see if it’s been added to a slightly wrong location please? For example ./sever/dist/dist or some other weirdness - I saw a lot of this kind of stuff when initially developing livepush so perhaps there’s an edge case that wasn’t caught.

Thanks!