Skip to content

Commit c6c1738

Browse files
Address code review feedback - optimize caching and remove duplicates
Co-authored-by: delicatacurtis <247246500+delicatacurtis@users.noreply.github.com>
1 parent a9a69c8 commit c6c1738

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
docs/
1010
DEVELOPER_NOTES.md
1111
ARCHITECTURE.md
12-
*.md
1312

1413
# CI/CD
1514
.circleci

.github/workflows/security.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,19 @@ jobs:
7676
with:
7777
php-version: '8.5'
7878
extensions: mbstring, bcmath, pdo, mysql, dom, curl
79+
80+
- name: Get Composer cache directory
81+
id: composer-cache
82+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
83+
84+
- name: Cache Composer dependencies
85+
uses: actions/cache@v4
86+
with:
87+
path: ${{ steps.composer-cache.outputs.dir }}
88+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
89+
restore-keys: |
90+
${{ runner.os }}-composer-
91+
7992
- name: 'Run php-insight'
8093
run: |
8194
PHP_SC_VERSION=$(curl -s "https://api.github.com/repos/fabpot/local-php-security-checker/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/;s/^v//')

Dockerfile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,13 @@ COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
119119
# Copy vendor from composer-deps stage for better caching
120120
COPY --chown=${USER}:${USER} --from=composer-deps /app/vendor ./vendor
121121

122+
# Copy composer files (needed for autoloader generation)
123+
COPY --chown=${USER}:${USER} composer.json composer.lock ./
124+
125+
# Generate optimized autoloader with vendor already in place
126+
RUN composer dump-autoload --classmap-authoritative --no-dev && \
127+
composer clear-cache
128+
122129
# Copy application code
123130
COPY --chown=${USER}:${USER} . .
124131

@@ -139,10 +146,6 @@ COPY --chown=${USER}:${USER} .docker/supervisord.*.conf /etc/supervisor/conf.d/
139146
COPY --chown=${USER}:${USER} .docker/php.ini ${PHP_INI_DIR}/conf.d/99-octane.ini
140147
COPY --chown=${USER}:${USER} .docker/start-container /usr/local/bin/start-container
141148

142-
# Generate optimized autoloader
143-
RUN composer dump-autoload --classmap-authoritative --no-dev && \
144-
composer clear-cache
145-
146149
# Copy environment file
147150
COPY --chown=${USER}:${USER} .env.example ./.env
148151

0 commit comments

Comments
 (0)