mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-01-17 07:39:33 +00:00
Simplify asset build: copy entire project instead of individual files
Refactored to copy the entire project directory in composer-deps and assets stages instead of cherry-picking specific files. This: - Eliminates the separate translations stage - Avoids missing file issues - Simplifies the build process - Maintains performance benefit of building assets once on native platform Both stages now use COPY . . to get all project files, avoiding the complexity of tracking which files are needed. Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com>
This commit is contained in:
parent
9402382d56
commit
6a1792d46a
2 changed files with 14 additions and 64 deletions
39
Dockerfile
39
Dockerfile
|
|
@ -8,30 +8,12 @@ FROM composer:latest AS composer-deps
|
||||||
|
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
|
|
||||||
# Copy composer files and install PHP dependencies (needed for Symfony UX assets)
|
# Copy entire project to install dependencies and generate translations
|
||||||
COPY composer.json composer.lock symfony.lock ./
|
COPY . .
|
||||||
RUN composer install --no-dev --no-scripts --no-autoloader --prefer-dist --ignore-platform-reqs
|
|
||||||
|
|
||||||
# ---
|
# Install composer dependencies (needed for Symfony UX assets and cache warmup)
|
||||||
|
RUN composer install --no-dev --no-scripts --no-autoloader --prefer-dist --ignore-platform-reqs && \
|
||||||
# Stage to generate Symfony translations needed for webpack
|
composer dump-autoload --no-dev --classmap-authoritative && \
|
||||||
FROM composer:latest AS translations
|
|
||||||
|
|
||||||
WORKDIR /build
|
|
||||||
|
|
||||||
# Copy composer dependencies and application files
|
|
||||||
COPY --from=composer-deps /build/vendor ./vendor
|
|
||||||
COPY composer.json composer.lock symfony.lock ./
|
|
||||||
COPY .env ./
|
|
||||||
COPY bin ./bin
|
|
||||||
COPY config ./config
|
|
||||||
COPY public ./public
|
|
||||||
COPY src ./src
|
|
||||||
COPY templates ./templates
|
|
||||||
COPY translations ./translations
|
|
||||||
|
|
||||||
# Generate autoloader and dump translations
|
|
||||||
RUN composer dump-autoload --no-dev --classmap-authoritative && \
|
|
||||||
php bin/console cache:clear --no-warmup && \
|
php bin/console cache:clear --no-warmup && \
|
||||||
php bin/console cache:warmup
|
php bin/console cache:warmup
|
||||||
|
|
||||||
|
|
@ -41,15 +23,8 @@ FROM node:22-bookworm-slim AS assets
|
||||||
|
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
|
|
||||||
# Copy vendor directory from composer stage (needed for Symfony UX packages)
|
# Copy entire project with vendor and generated translations from composer-deps stage
|
||||||
COPY --from=composer-deps /build/vendor ./vendor
|
COPY --from=composer-deps /build ./
|
||||||
|
|
||||||
# Copy generated translations from Symfony
|
|
||||||
COPY --from=translations /build/var/translations ./var/translations
|
|
||||||
|
|
||||||
# Copy package files
|
|
||||||
COPY package.json yarn.lock webpack.config.js ./
|
|
||||||
COPY assets ./assets
|
|
||||||
|
|
||||||
# Install dependencies and build assets
|
# Install dependencies and build assets
|
||||||
RUN yarn install --network-timeout 600000 && \
|
RUN yarn install --network-timeout 600000 && \
|
||||||
|
|
|
||||||
|
|
@ -5,30 +5,12 @@ FROM composer:latest AS composer-deps
|
||||||
|
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
|
|
||||||
# Copy composer files and install PHP dependencies (needed for Symfony UX assets)
|
# Copy entire project to install dependencies and generate translations
|
||||||
COPY composer.json composer.lock symfony.lock ./
|
COPY . .
|
||||||
RUN composer install --no-dev --no-scripts --no-autoloader --prefer-dist --ignore-platform-reqs
|
|
||||||
|
|
||||||
# ---
|
# Install composer dependencies (needed for Symfony UX assets and cache warmup)
|
||||||
|
RUN composer install --no-dev --no-scripts --no-autoloader --prefer-dist --ignore-platform-reqs && \
|
||||||
# Stage to generate Symfony translations needed for webpack
|
composer dump-autoload --no-dev --classmap-authoritative && \
|
||||||
FROM composer:latest AS translations
|
|
||||||
|
|
||||||
WORKDIR /build
|
|
||||||
|
|
||||||
# Copy composer dependencies and application files
|
|
||||||
COPY --from=composer-deps /build/vendor ./vendor
|
|
||||||
COPY composer.json composer.lock symfony.lock ./
|
|
||||||
COPY .env ./
|
|
||||||
COPY bin ./bin
|
|
||||||
COPY config ./config
|
|
||||||
COPY public ./public
|
|
||||||
COPY src ./src
|
|
||||||
COPY templates ./templates
|
|
||||||
COPY translations ./translations
|
|
||||||
|
|
||||||
# Generate autoloader and dump translations
|
|
||||||
RUN composer dump-autoload --no-dev --classmap-authoritative && \
|
|
||||||
php bin/console cache:clear --no-warmup && \
|
php bin/console cache:clear --no-warmup && \
|
||||||
php bin/console cache:warmup
|
php bin/console cache:warmup
|
||||||
|
|
||||||
|
|
@ -38,15 +20,8 @@ FROM node:22-bookworm-slim AS assets
|
||||||
|
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
|
|
||||||
# Copy vendor directory from composer stage (needed for Symfony UX packages)
|
# Copy entire project with vendor and generated translations from composer-deps stage
|
||||||
COPY --from=composer-deps /build/vendor ./vendor
|
COPY --from=composer-deps /build ./
|
||||||
|
|
||||||
# Copy generated translations from Symfony
|
|
||||||
COPY --from=translations /build/var/translations ./var/translations
|
|
||||||
|
|
||||||
# Copy package files
|
|
||||||
COPY package.json yarn.lock webpack.config.js ./
|
|
||||||
COPY assets ./assets
|
|
||||||
|
|
||||||
# Install dependencies and build assets
|
# Install dependencies and build assets
|
||||||
RUN yarn install --network-timeout 600000 && \
|
RUN yarn install --network-timeout 600000 && \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue