'Kubernetes + Docker + Rails issue serving assets

After laboring through getting my kubernetes cluster up. I hit a new road block ActionView::Template::Error (The asset 'application.css' was not found in the load path.):. I can't quite figure out why my assets are not being served. See belong for the configuration code for Docker and docker-compose. There are no errors during the build process and I can verified that the digested file is present in the public/assets folder in the container.

Dockerfile

FROM ruby:3.1-alpine

RUN apk add --update --no-cache \
  binutils-gold \
  build-base \
  curl \
  file \
  g++ \
  gcc \
  git \
  less \
  libstdc++ \
  libffi-dev \
  libc-dev \
  linux-headers \
  libxml2-dev \
  libxslt-dev \
  libgcrypt-dev \
  make \
  netcat-openbsd \
  openssl \
  pkgconfig \
  postgresql-dev \
  tzdata
ARG GITHUB_ACCESS_TOKEN=${GITHUB_ACCESS_TOKEN}
ARG SECRET_KEY_BASE=${SECRET_KEY_BASE}

RUN gem install bundler -v 2.3.7

RUN mkdir /app
WORKDIR /app
COPY Gemfile Gemfile.lock ./
RUN bundle config GITHUB__COM ${GITHUB_ACCESS_TOKEN}:x-oauth-basic
RUN bundle config build.nokogiri --use-system-libraries
RUN bundle check || bundle install
COPY . ./

EXPOSE 3000
CMD ["./.scripts/docker-entrypoint.sh"]
RUN RAILS_ENV=production SECRET_KEY_BASE=${SECRET_KEY_BASE} bundle exec rake assets:precompile

docker-compose.yml

version: '3'

services:
  app:
    image: ghcr.io/user/image:latest # private repo
    depends_on:
      - postgres
      - redis
    ports:
        - "3000:3000"
    env_file: .env
  postgres:
    image: postgres:14.2-alpine
    volumes:
      - db_data:/var/lib/postgresql/data
    env_file: .env
    ports:
        - "5432:5432"
    environment:
      PGDATA: /var/lib/postgresql/data/pgdata

  redis:
    image: redis:5.0.7-alpine
    ports:
        - "6379:6379"

  sidekiq:
    image: ghcr.io/user/image:latest # private repo
    depends_on:
      - app
      - postgres
      - redis
    env_file: .env
    entrypoint: ./.scripts/sidekiq-entrypoint.sh

volumes:
  db_data:

docker-entrypoint.sh


set -e

if [ -f tmp/pids/server.pid ]; then
  rm tmp/pids/server.pid
fi

bundle exec rails s -b 0.0.0.0


Solution 1:[1]

Seems like the issue was the combination of dartsass-rails and ruby:3.1-alpine everything works fine with ruby:3.1

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 dnwilson