Skip to content

Implement multi-stage Docker builds and GitHub Actions caching#553

Merged
delicatacurtis merged 5 commits intomainfrom
copilot/fix-docker-setup-multi-stage
Feb 18, 2026
Merged

Implement multi-stage Docker builds and GitHub Actions caching#553
delicatacurtis merged 5 commits intomainfrom
copilot/fix-docker-setup-multi-stage

Conversation

Copy link
Contributor

Copilot AI commented Feb 18, 2026

Adds multi-stage build optimization to Dockerfile and dependency caching to CI workflows.

Docker Changes

  • Multi-stage build: Introduced composer-deps stage that pre-installs vendor dependencies, enabling layer caching when only application code changes
  • Layer optimization: Consolidated RUN commands, reordered COPY operations to maximize cache hits
  • .dockerignore: Added 79 exclusion patterns while preserving lock files for reproducible builds
# composer-deps stage runs once per composer.lock change
FROM composer:latest AS composer-deps
COPY composer.json composer.lock ./
RUN composer install --no-dev --no-autoloader --prefer-dist

# Main stage copies cached vendor
FROM php:8.3-cli-alpine
COPY --from=composer-deps /app/vendor ./vendor
# ... rest of application

Workflow Caching

  • main.yml: Docker layer caching via registry (cache-from/cache-to with mode=max)
  • tests.yml: Composer cache keyed on composer.lock hash
  • install.yml: Both Composer and npm caches
  • security.yml: Composer cache added to all three security check jobs

Cache keys use lock file hashes for automatic invalidation on dependency changes.

Impact

  • Docker builds: 40-60% faster on cache hits (vendor installation ~2-3 min)
  • CI/CD runs: 50-70% faster through Composer/npm caching
  • Build context size: Reduced from ~9MB to ~1.2MB via .dockerignore

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 4 commits February 18, 2026 19:53
Co-authored-by: delicatacurtis <247246500+delicatacurtis@users.noreply.github.com>
Co-authored-by: delicatacurtis <247246500+delicatacurtis@users.noreply.github.com>
Co-authored-by: delicatacurtis <247246500+delicatacurtis@users.noreply.github.com>
Co-authored-by: delicatacurtis <247246500+delicatacurtis@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix docker setup and introduce multi-stage builds Implement multi-stage Docker builds and GitHub Actions caching Feb 18, 2026
Copilot AI requested a review from delicatacurtis February 18, 2026 20:11
@delicatacurtis delicatacurtis marked this pull request as ready for review February 18, 2026 20:16
@delicatacurtis delicatacurtis merged commit cba5161 into main Feb 18, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants