Im trying to produce a production ready docker container which could have all the nova features, but my custom component (field) is missing when i build the image. Dockerfile
# Stage 1
FROM node:20 AS build-stage
WORKDIR /app
COPY package*.json ./
RUN npm install --legacy-peer-deps
COPY . .
RUN npm install laravel-mix@latest
RUN npm run build:icons
RUN npm run build
RUN npm run build-location_search-prod
# Stage 2
FROM php:8.3.2-fpm
ARG UID=1000
ARG GID=1000
ENV COMPOSER_ALLOW_SUPERUSER=1
RUN apt-get update && apt-get install -y
git
curl
libpng-dev
libonig-dev
libxml2-dev
zip
unzip
libzip-dev
gnupg2
libicu-dev
&& pecl install mongodb
&& docker-php-ext-enable mongodb
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd zip intl
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
WORKDIR /var/www
COPY . /var/www
RUN composer install --no-dev --optimize-autoloader
COPY --from=build-stage /app/public/build /var/www/public/build
COPY --from=build-stage /app/nova-components /var/www/nova-components
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
RUN groupadd -g ${GID} appgroup &&
useradd -u ${UID} -g appgroup -m appuser &&
chown -R appuser:appgroup /var/www
USER appuser
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["php-fpm"]
Can’t understand where should I put the nova components dist folder then that it could be accessible in production env.
My app consists of Laravel + Vite (Vue) + Laravel Nova
Everything works fine expect my laravel nova custom field.
The package.json itself has script as well like this which is executing:
"build-location_search-prod": "cd nova-components/LocationSearch && npm run prod"
So basically after container builds the LocationSearch/dist folder is generated by running the script, but the field inside the nova resource is not shown. It was showing when I ran development environment. Now when serving via nginx and build directories its hidden.