Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 47 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Aggressive .dockerignore for faster Docker builds
# Most content is volume-mounted in docker-compose.yml for development

_site
node_modules
.git
Expand All @@ -7,7 +10,50 @@ node_modules
.mega-linter.yml
.pre-commit-config.yaml
.shellcheckrc
docker-compose.yml
docker-compose*.yml
serve.Dockerfile
README.md

# Large directories that will be volume-mounted for development
# These are the primary culprits for slow build context transfer
_image_sources
galleries
content
_drafts
assets

# Other directories that will be volume-mounted
products
navigation_and_indexes
error_pages
admin
_posts
_data
_includes

# Development and build artifacts
dist
*.log
.DS_Store
Thumbs.db

# IDE files
.vscode
.idea
*.swp
*.swo

# Temporary files
.tmp
tmp

# Keep essential files for build
!package.json
!package-lock.json
!.eleventy.js
!_config.yml
!webpack.config.js
!src/
!tests/
!.github/scripts/staging/default.conf
!htaccess
1 change: 1 addition & 0 deletions .eleventyignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
./tests
./.github
Dockerfile
DOCKER_OPTIMIZATION.md
19 changes: 11 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
# Development build - minimal context needed since content is volume-mounted
FROM node:24-bullseye AS base

# Create app directory
WORKDIR /app/src

# Install dependencies
# Copy package files and install dependencies
# This is all that's needed for development since source is volume-mounted
COPY package.json package-lock.json ./
RUN npm ci

# Development debug build
FROM base AS debug

RUN apt-get update && apt-get install -y \
less \
iputils-ping \
dnsutils

# Copy app source for development
COPY . /app/src
# For development, source code is volume-mounted, not copied

# Broken link checker stage
FROM dcycle/broken-link-checker:3 AS broken_link_checker

# Production HTTP server build - needs full content
FROM httpd:2.4.64 AS httpd_serve

# Install curl for healthcheck
Expand All @@ -45,6 +49,7 @@ RUN if [ -f /tmp/build_context/httpd.conf ]; then \
# Copy site content to web directory
COPY . /usr/local/apache2/htdocs/

# Test build - needs some content for testing
FROM base AS tests

# Install necessary packages for Playwright
Expand All @@ -61,13 +66,11 @@ RUN apt-get update && apt-get install -y \
# Install Playwright browsers
RUN npx playwright install chromium --with-deps

# Copy app source for testing
COPY . /app/src
# Copy test files
COPY tests/ ./tests/

# Set default command to run BDD tests
CMD ["npm", "run", "test:bdd"]

# Default stage for development - just the base with npm dependencies
FROM base

# Copy app source for the final stage
COPY . /app/src
25 changes: 25 additions & 0 deletions dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Minimal development Dockerfile
# Only installs npm dependencies since content is volume-mounted
FROM node:24-bullseye AS base

# Create app directory
WORKDIR /app/src

# Copy package files and install dependencies
COPY package.json package-lock.json ./

# Optimize npm ci for better performance in CI environments
RUN npm ci --prefer-offline --no-audit --progress=false

# Development debug build
FROM base AS debug

RUN apt-get update && apt-get install -y \
less \
iputils-ping \
dnsutils

# Source code will be volume-mounted at runtime

# Default stage - just npm dependencies installed
FROM base
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ services:
serve:
build:
context: .
dockerfile: Dockerfile
dockerfile: dev.Dockerfile
command: ["npm", "run", "serve"]
volumes:
- .:/app/src
Expand All @@ -16,7 +16,7 @@ services:
dist:
build:
context: .
dockerfile: Dockerfile
dockerfile: dev.Dockerfile
command: ["npm", "run", "dist"]
volumes:
- .:/app/src
Expand All @@ -25,7 +25,7 @@ services:
build:
build:
context: .
dockerfile: Dockerfile
dockerfile: dev.Dockerfile
command: ["npm", "run", "11ty"]
volumes:
- .:/app/src
Expand Down Expand Up @@ -61,7 +61,7 @@ services:
shell:
build:
context: .
dockerfile: Dockerfile
dockerfile: dev.Dockerfile
target: debug
command: ["bash"]
volumes:
Expand Down