Skip to content

Commit aac6630

Browse files
MohsinHashmi-DataInnmohsin-wiserclaude
authored
fix(devcontainer): use Maven wrapper for dependency caching (#330)
* fix(devcontainer): add workspace mount to docker-compose - add explicit workspace mount ../:/workspaces/SimpleAccounts-UAE - use fixed workspace path instead of variable - fixes 'lstat /workspaces/content: no such file or directory' error 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore(devcontainer): optimize prebuilt image performance - Bake Playwright system dependencies into Dockerfile - Combine apt-get layers for efficiency - Pre-cache Maven and NPM dependencies during build - Update post-create.sh to utilize pre-seeded caches * fix(devcontainer): remove duplicate instructions and include .npmrc * fix(devcontainer): use Maven wrapper for dependency caching The base image mcr.microsoft.com/devcontainers/java:21-bookworm does not have Maven pre-installed, causing the prebuild to fail with exit code 127 (mvn: command not found). Changes: - Use Maven wrapper (./mvnw) instead of mvn command - Copy mvnw and .mvn/ directory for wrapper to work - Use dependency:resolve instead of go-offline to avoid HTTP repo blocking - Add graceful fallbacks (|| true) for partial dependency caching - Add npm install fallback when lockfiles are out of sync 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Mohsin Hashmi <mhashmi@wiser.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent f372215 commit aac6630

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,25 @@ RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g npm@lates
8989
USER vscode
9090

9191
# Pre-cache Maven dependencies
92-
# Copy pom.xml files (and parent poms if needed) to a temp directory
92+
# Copy pom.xml, Maven wrapper, and .mvn directory
9393
WORKDIR /tmp/backend
94-
COPY --chown=vscode:vscode apps/backend/pom.xml .
95-
# Run go-offline to download dependencies to ~/.m2/repository
96-
RUN mvn dependency:go-offline -B -q
94+
COPY --chown=vscode:vscode apps/backend/pom.xml apps/backend/mvnw ./
95+
COPY --chown=vscode:vscode apps/backend/.mvn .mvn
96+
# Download dependencies to ~/.m2/repository
97+
# Uses Maven wrapper since Maven is not pre-installed in the base image
98+
# Note: Uses dependency:resolve instead of go-offline to avoid HTTP repository blocking issues
99+
# Allow partial caching if some dependencies fail (|| true)
100+
RUN chmod +x mvnw && ./mvnw dependency:resolve -B -q || true
97101

98102
# Pre-cache NPM dependencies
103+
# Note: Using npm install with fallback to allow partial caching if lockfiles are out of sync
99104
WORKDIR /tmp/root
100105
COPY --chown=vscode:vscode package.json package-lock.json ./
101-
RUN . /usr/local/share/nvm/nvm.sh && npm ci --ignore-scripts
106+
RUN . /usr/local/share/nvm/nvm.sh && (npm ci --ignore-scripts || npm install --ignore-scripts || true)
102107

103108
WORKDIR /tmp/frontend
104109
COPY --chown=vscode:vscode apps/frontend/package.json apps/frontend/package-lock.json apps/frontend/.npmrc* ./
105-
RUN . /usr/local/share/nvm/nvm.sh && npm ci --legacy-peer-deps --ignore-scripts
110+
RUN . /usr/local/share/nvm/nvm.sh && (npm ci --legacy-peer-deps --ignore-scripts || npm install --legacy-peer-deps --ignore-scripts || true)
106111

107112
# Clean up temp directories
108113
USER root

0 commit comments

Comments
 (0)