Skip to content

Commit 08eee49

Browse files
authored
Merge branch 'master' into copilot/fix-262
2 parents 6615e67 + c0868ac commit 08eee49

File tree

6 files changed

+95
-29
lines changed

6 files changed

+95
-29
lines changed

.dockerignore

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Aggressive .dockerignore for faster Docker builds
2+
# Most content is volume-mounted in docker-compose.yml for development
3+
14
_site
25
node_modules
36
.git
@@ -7,7 +10,50 @@ node_modules
710
.mega-linter.yml
811
.pre-commit-config.yaml
912
.shellcheckrc
10-
docker-compose.yml
13+
docker-compose*.yml
1114
serve.Dockerfile
1215
README.md
16+
17+
# Large directories that will be volume-mounted for development
18+
# These are the primary culprits for slow build context transfer
1319
_image_sources
20+
galleries
21+
content
22+
_drafts
23+
assets
24+
25+
# Other directories that will be volume-mounted
26+
products
27+
navigation_and_indexes
28+
error_pages
29+
admin
30+
_posts
31+
_data
32+
_includes
33+
34+
# Development and build artifacts
35+
dist
36+
*.log
37+
.DS_Store
38+
Thumbs.db
39+
40+
# IDE files
41+
.vscode
42+
.idea
43+
*.swp
44+
*.swo
45+
46+
# Temporary files
47+
.tmp
48+
tmp
49+
50+
# Keep essential files for build
51+
!package.json
52+
!package-lock.json
53+
!.eleventy.js
54+
!_config.yml
55+
!webpack.config.js
56+
!src/
57+
!tests/
58+
!.github/scripts/staging/default.conf
59+
!htaccess

.eleventyignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
./tests
55
./.github
66
Dockerfile
7+
DOCKER_OPTIMIZATION.md

.github/copilot-instructions.md

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,14 @@ Orionrobots is a static website about robotics using Eleventy (11ty) static site
1212
- Build assets and site manually:
1313
- `docker compose run dist` -- builds webpack bundle.js, takes ~30 seconds
1414
- `docker compose run build` -- builds full static site, takes ~3 minutes. Set timeout to 240+ seconds.
15-
- Alternative native workflow:
16-
```bash
17-
npm install
18-
npm run dist
19-
npm run 11ty
20-
```
2115

2216
### Development Server
2317
- Run local development server:
2418
- `docker compose up serve` -- starts Eleventy dev server on port 8081, **NEVER CANCEL** - builds then watches files. Set timeout to 300+ seconds for initial build.
25-
- Alternative native: `npm run serve` -- starts Eleventy dev server directly
26-
- Manual serving: After building, serve with Python: `cd _site && python3 -m http.server 8082`
2719

2820
### Testing Commands
2921
- BDD integration tests:
3022
- `docker compose run test` -- runs Cucumber.js tests with Playwright in containerized environment
31-
- Alternative native: `npm run test:bdd` or `npm test` -- runs tests directly on host
3223
- **Note**: Playwright installation may fail in some CI environments
3324
- Tests require a running staging server to test against
3425

@@ -49,7 +40,6 @@ Always test these key pages that are verified in CI:
4940

5041
### Build Verification
5142
- Run `docker compose run dist && docker compose run build` and verify `_site` directory is created with content
52-
- Alternative native: `npm run dist && npm run 11ty`
5343
- Check that `_site/index.html` exists and contains proper HTML structure
5444
- Verify `dist/bundle.js` exists and is approximately 330KB
5545

@@ -68,6 +58,7 @@ dist/ -- Webpack build output (bundle.js)
6858
docker-compose.yml -- Docker development environment setup
6959
package.json -- npm dependencies and scripts
7060
src/ -- Source files for Webpack
61+
tests/staging -- Gherkin-based BDD tests for website functionality
7162
webpack.config.js -- Webpack configuration
7263
```
7364

@@ -79,16 +70,13 @@ webpack.config.js -- Webpack configuration
7970
## Build Process Details
8071

8172
### Build Order (Critical)
82-
1. **Webpack Build** (`docker compose run dist` or `npm run dist`): Creates `dist/bundle.js` with CSS and JS assets
83-
2. **Eleventy Build** (`docker compose run build` or `npm run 11ty`): Processes markdown, creates HTML, copies assets to `_site/`
73+
1. **Webpack Build** (`docker compose run dist`): Creates `dist/bundle.js` with CSS and JS assets
74+
2. **Eleventy Build** (`docker compose run build`): Processes markdown, creates HTML, copies assets to `_site/`
8475

8576
### Timing Expectations
8677
- Docker compose up: ~4-5 minutes for initial build and start (set 300+ second timeout)
8778
- Docker dist build: ~30 seconds (set 60+ second timeout)
8879
- Docker site build: ~3 minutes (**NEVER CANCEL** - set 240+ second timeout)
89-
- Alternative native npm install: ~1 minute (standard timeout OK)
90-
- Alternative native webpack dist: ~7 seconds (set 30+ second timeout)
91-
- Alternative native Eleventy build: ~2.5 minutes (**NEVER CANCEL** - set 180+ second timeout)
9280

9381
### Known Build Warnings
9482
- Sass deprecation warnings about @import rules (normal, build continues)
@@ -132,6 +120,9 @@ This creates properly structured content with frontmatter in `content/YYYY/MM/`
132120
- CSS/JS: Add to `src/` and import in `src/index.js`
133121
- Static files: Use Eleventy passthrough copy in `.eleventy.js`
134122

123+
### Adding scripts or utilities
124+
- Ensure these are run through a docker compose command
125+
135126
### Troubleshooting Build Issues
136127
1. Clear containers and rebuild: `docker compose down && docker compose build --no-cache`
137128
2. Clear build outputs: `docker compose run --rm base rm -rf _site dist`
@@ -162,4 +153,4 @@ This is a Jekyll-to-Eleventy migrated project (now fully Eleventy) with:
162153
- Extensive robotics content and tutorials
163154
- Apache hosting with custom htaccess rules
164155

165-
**CRITICAL REMINDER**: Use Docker Compose as the primary development method. Never cancel long-running builds - they can take 3-5+ minutes for initial setup.
156+
**CRITICAL REMINDER**: Use Docker Compose as the primary development method. Never cancel long-running builds - they can take 3-5+ minutes for initial setup.

Dockerfile

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
1+
# Development build - minimal context needed since content is volume-mounted
12
FROM node:24-bullseye AS base
23

34
# Create app directory
45
WORKDIR /app/src
56

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

12+
# Development debug build
1013
FROM base AS debug
1114

1215
RUN apt-get update && apt-get install -y \
1316
less \
1417
iputils-ping \
1518
dnsutils
1619

17-
# Copy app source for development
18-
COPY . /app/src
20+
# For development, source code is volume-mounted, not copied
1921

22+
# Broken link checker stage
2023
FROM dcycle/broken-link-checker:3 AS broken_link_checker
2124

25+
# Production HTTP server build - needs full content
2226
FROM httpd:2.4.64 AS httpd_serve
2327

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

52+
# Test build - needs some content for testing
4853
FROM base AS tests
4954

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

64-
# Copy app source for testing
65-
COPY . /app/src
69+
# Copy test files
70+
COPY tests/ ./tests/
6671

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

75+
# Default stage for development - just the base with npm dependencies
7076
FROM base
71-
72-
# Copy app source for the final stage
73-
COPY . /app/src

dev.Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Minimal development Dockerfile
2+
# Only installs npm dependencies since content is volume-mounted
3+
FROM node:24-bullseye AS base
4+
5+
# Create app directory
6+
WORKDIR /app/src
7+
8+
# Copy package files and install dependencies
9+
COPY package.json package-lock.json ./
10+
11+
# Optimize npm ci for better performance in CI environments
12+
RUN npm ci --prefer-offline --no-audit --progress=false
13+
14+
# Development debug build
15+
FROM base AS debug
16+
17+
RUN apt-get update && apt-get install -y \
18+
less \
19+
iputils-ping \
20+
dnsutils
21+
22+
# Source code will be volume-mounted at runtime
23+
24+
# Default stage - just npm dependencies installed
25+
FROM base

docker-compose.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ services:
22
serve:
33
build:
44
context: .
5-
dockerfile: Dockerfile
5+
dockerfile: dev.Dockerfile
66
command: ["npm", "run", "serve"]
77
volumes:
88
- .:/app/src
@@ -16,7 +16,7 @@ services:
1616
dist:
1717
build:
1818
context: .
19-
dockerfile: Dockerfile
19+
dockerfile: dev.Dockerfile
2020
command: ["npm", "run", "dist"]
2121
volumes:
2222
- .:/app/src
@@ -25,7 +25,7 @@ services:
2525
build:
2626
build:
2727
context: .
28-
dockerfile: Dockerfile
28+
dockerfile: dev.Dockerfile
2929
command: ["npm", "run", "11ty"]
3030
volumes:
3131
- .:/app/src
@@ -61,7 +61,7 @@ services:
6161
shell:
6262
build:
6363
context: .
64-
dockerfile: Dockerfile
64+
dockerfile: dev.Dockerfile
6565
target: debug
6666
command: ["bash"]
6767
volumes:

0 commit comments

Comments
 (0)