FROM node:18-slim
# Create app directory
WORKDIR /app
# Install system dependencies needed for building and fetching dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
git ca-certificates python3 build-essential && \
rm -rf /var/lib/apt/lists/*
# Install global tooling for building front-end assets
RUN npm install -g bower less
# Install project dependencies (package.json and bower.json are copied first to leverage Docker cache)
COPY package.json bower.json ./
RUN npm install && npm cache clean --force
RUN bower install --allow-root
# Copy the rest of the repository
COPY . .
# Build assets from source when possible. If Less is not available, fall back to existing minified CSS.
RUN mkdir -p css && \
if command -v lessc >/dev/null 2>&1; then \
lessc less/bootstrap-markdown.less css/bootstrap-markdown.css; \
else \
cp css/bootstrap-markdown.min.css css/bootstrap-markdown.css; \
fi
# Default command: drop into a shell for testing or usage
CMD ["bash"]
node_modules bower_components .DS_Store .git .gitignore .env package-lock.json
node_modules bower_components .DS_Store .git .gitignore .env package-lock.json
- Exact error message and exit code
- NameError: .box-shadow is undefined in /app/less/bootstrap-markdown.less on line 66, column 5:
65 outline: 0;
66 .box-shadow(~"inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px @{color-rgba}");
67 }
- Exit code: 1
- Failing command/step
- RUN mkdir -p css && if command -v lessc >/dev/null 2>&1; then lessc less/bootstrap-markdown.less css/bootstrap-markdown.css; else cp css/bootstrap-markdown.min.css css/bootstrap-markdown.css; fi
- Missing packages or files mentioned
- No explicit missing package/file errors were reported. The failure is due to a Less compilation error inside /app/less/bootstrap-markdown.less (the .box-shadow mixin is undefined).
- Version mismatch info
- Image base: node:18-slim
- Notable version-related note in logs: npm shows "New major version of npm available! 10.8.2 -> 11.12.0" (at step 8), which is a version update hint rather than a direct mismatch causing this failure.FROM node:18-slim
# Create app directory
WORKDIR /app
# Install system dependencies needed for building and fetching dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
git ca-certificates python3 build-essential && \
rm -rf /var/lib/apt/lists/*
# Install global tooling for building front-end assets
RUN npm install -g bower less
# Install project dependencies (package.json and bower.json are copied first to leverage Docker cache)
COPY package.json bower.json ./
RUN npm install && npm cache clean --force
RUN bower install --allow-root
# Copy the rest of the repository
COPY . .
# Build assets from source when possible. If Less is not available or fails, fall back to existing minified CSS.
RUN mkdir -p css && \
if command -v lessc >/dev/null 2>&1; then \
if lessc less/bootstrap-markdown.less css/bootstrap-markdown.css; then \
echo "Less compiled successfully"; \
else \
echo "Less compilation failed, using prebuilt CSS"; \
cp css/bootstrap-markdown.min.css css/bootstrap-markdown.css; \
fi; \
else \
echo "lessc not found, using prebuilt CSS"; \
cp css/bootstrap-markdown.min.css css/bootstrap-markdown.css; \
fi
# Default command: drop into a shell for testing or usage
CMD ["bash"]
Concerns: Uses deprecated Bower for front-end dependencies; consider migrating to npm/yarn, Build step falls back to prebuilt CSS if lessc is unavailable; this may hide issues with Less compilation Smoke [PASS]: node -v Smoke [PASS]: npm -v Smoke [PASS]: bower -v