Deployed Phoenix app does not honor css instructions

dokku -v says: 0.20.4 on my

~# uname -a
Linux docker1 4.19.0-9-amd64 #1 SMP Debian 4.19.118-2+deb10u1 (2020-06-07) x86_64 GNU/Linux

I was experiencing a similar issue in a standard gigalixir mix release and this was my issue. The solution for now was turning off purgeCSS until I have time to write better rules.

1 Like

Thanks for the detailed explanations.

1 Like

You may use the Dockerfile example from the phoenix documentation, you may remove the python dependency, but if you use it with tailwindcss and purgeCSS in special, you have to move the COPY lib lib command above the RUN npm run --prefix ./assets deploy, because purgeCSS will not be able to find any CSS class usage.

thx to this post http://disq.us/p/2bsocpx

sorry, for just repeating @praveenperera

3 Likes

I had the same issue. I could not find any workaround. Finally I created the release on my local machine and moved it to the docker image. This is my Dockerfile:

ARG ELIXIR_VERSION=1.15.0
ARG OTP_VERSION=26.0
ARG UBUNTU_VERSION=jammy-20230126

ARG RUNNER_IMAGE="ubuntu:${UBUNTU_VERSION}"

FROM ${RUNNER_IMAGE}

RUN apt-get update -y && apt-get install -y libstdc++6 openssl libncurses5 locales \
  && apt-get clean && rm -f /var/lib/apt/lists/*_*

# Set the locale
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen

ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8

WORKDIR "/app"
RUN chown nobody /app

# set runner ENV
ENV MIX_ENV="prod"

# Only copy the final release from the local machine

COPY --chown=nobody:root ./_build/${MIX_ENV}/rel/pento ./

USER nobody

CMD /app/bin/server