I have worked it out (Should have read the Dockerfile comments a bit earlier). The first change I had to make was to install npm and nodejs packages on the BUILDER container:
Dockerfile
...
# install build dependencies
RUN apt-get update -y && apt-get install -y build-essential git nodejs npm \
&& apt-get clean && rm -f /var/lib/apt/lists/*_*
...
The next change was based on the comments that I missed the first time:
# note: if your project uses a tool like https://purgecss.com/,
# which customizes asset compilation based on what it finds in
# your Elixir templates, you will need to move the asset compilation
# step down so that `lib` is available.
This meant I needed to change the order so the Tailwind purge would work.
Dockerfile
COPY lib lib
COPY priv priv
COPY assets assets
RUN mix assets.deploy
RUN mix compile
This was the order that I finally settled on. The last piece of the puzzle was my final error which was that TailwindCSS was unavailable. so I added in the following line before RUN mix assets.deploy
...
RUN cd assets && npm install
RUN mix assets.deploy
...
With these changes deployment worked.
Andrew