# syntax=docker/dockerfile:1 FROM node:22.22.3-alpine3.23 AS builder WORKDIR /work # Copy repository into the builder image COPY . . # Build the Font Awesome Free package (install dependencies) RUN cd js-packages/@fortawesome/fontawesome-free && npm install FROM node:22.22.3-alpine3.23 WORKDIR /app # Copy built assets from the builder stage COPY --from=builder /work/js-packages/@fortawesome/fontawesome-free /app/fontawesome-free # Install a lightweight static file server for runtime access RUN npm install -g http-server EXPOSE 8080 CMD ["http-server", "/app/fontawesome-free", "-p", "8080"]
TODO
# Docker ignore file .git node_modules css/*.map js-packages/**/node_modules *.log npm-debug.log .env .vscode .idea .DS_Store dist build coverage tests **/*.md *.png *.jpg
Concerns: The build stage only runs npm install inside the fontawesome-free package and does not explicitly run a build script. If the package requires a separate build step (e.g., npm run build) to generate the published assets, the final image may serve incomplete content. If assets are already prebuilt in the repository, this is fine. Smoke [FAIL]: docker run --rm --entrypoint "" <image> sh -c "http-server /app/fontawesome-free -p 8080 >/dev/null 2>&1 & SERVER_PID=$!; sleep 1; curl -fsS http://localhost:8080/css/all.css | grep -q 'font-family' || (kill $SERVER_PID; exit 1); kill $SERVER_PID Output: sh: syntax error: unterminated quoted string Smoke [FAIL]: docker run --rm --entrypoint "" <image> sh -c "grep -qi 'Font Awesome' /app/fontawesome-free/css/all.css || (echo 'missing'; exit 1); echo ok Output: sh: syntax error: unterminated quoted string
# syntax=docker/dockerfile:1 FROM node:22.22.3-alpine3.23 AS builder WORKDIR /work # Copy repository into the builder image COPY . . # Build the Font Awesome Free package (install dependencies) RUN cd js-packages/@fortawesome/fontawesome-free && npm install FROM node:22.22.3-alpine3.23 # Install bash for better shell compatibility in smoke tests RUN apk add --no-cache bash curl # Optional: make /bin/sh point to bash for compatibility with some tests RUN rm -f /bin/sh && ln -s /bin/bash /bin/sh WORKDIR /app # Copy built assets from the builder stage COPY --from=builder /work/js-packages/@fortawesome/fontawesome-free /app/fontawesome-free # Install a lightweight static file server for runtime access RUN npm install -g http-server EXPOSE 8080 CMD ["http-server", "/app/fontawesome-free", "-p", "8080"]
Smoke [FAIL]: sh -c "http-server /app/fontawesome-free -p 8080 >/tmp/serv.log 2>&1 & PID=$!; sleep 1; curl -sS http://localhost:8080/fontawesome-free/css/all.min.css | grep -q '\.fa-'; kill $PID; exit $?$ Output: sh: -c: line 2: unexpected EOF while looking for matching `"' Smoke [FAIL]: sh -c "http-server /app/fontawesome-free -p 8080 >/tmp/serv.log 2>&1 & PID=$!; sleep 1; SIZE=$(curl -sS http://localhost:8080/fontawesome-free/webfonts/fa-solid-900.woff2 | wc -c); kill $PID; if [ \"$SIZE\" -gt 0 ]; then exit 0; else exit 1; fi Output: sh: -c: line 2: unexpected EOF while looking for matching `"'
# syntax=docker/dockerfile:1 FROM node:22.22.3-alpine3.23 AS builder WORKDIR /work # Copy repository into the builder image COPY . . # Build the Font Awesome Free package (install dependencies) RUN cd js-packages/@fortawesome/fontawesome-free && npm install FROM node:22.22.3-alpine3.23 WORKDIR /app # Copy built assets from the builder stage COPY --from=builder /work/js-packages/@fortawesome/fontawesome-free /app/fontawesome-free # Install a lightweight static file server for runtime access RUN apk add --no-cache curl RUN npm install -g http-server EXPOSE 8080 CMD ["http-server", "/app/fontawesome-free", "-p", "8080"]
Concerns: The build stage uses npm install only; ensure that this actually results in the distributable assets being present (some packages require a build step)., COPY path/structure relies on js-packages/@fortawesome/fontawesome-free existing in the repo; if the path changes, the final image may be empty. Smoke [FAIL]: set -e; http-server /app/fontawesome-free -p 8080 & SERVER=$!; sleep 0.6; curl -s http://localhost:8080/ | grep -q fontawesome-free; kill $SERVER Output:
# syntax=docker/dockerfile:1 FROM node:22.22.3-alpine3.23 AS builder WORKDIR /work # Copy repository into the builder image COPY . . # Build the Font Awesome Free package (install dependencies) RUN cd js-packages/@fortawesome/fontawesome-free && npm install FROM node:22.22.3-alpine3.23 WORKDIR /app # Copy built assets from the builder stage COPY --from=builder /work/js-packages/@fortawesome/fontawesome-free /app/fontawesome-free # Install a lightweight static file server for runtime access RUN apk add --no-cache curl RUN npm install -g http-server EXPOSE 8080 # Serve the assets directory at the root so URLs like /fontawesome-free/... work CMD ["http-server", "/app", "-p", "8080"]
Smoke [FAIL]: sh -c 'http-server /app -p 8080 >/dev/null 2>&1 & sleep 1; curl -fsS http://localhost:8080/fontawesome-free/css/all.css | grep -q "Font Awesome Output: sh: syntax error: unterminated quoted string Smoke [FAIL]: sh -c 'http-server /app -p 8080 >/dev/null 2>&1 & sleep 1; curl -fsS http://localhost:8080/fontawesome-free/css/all.css | grep -q "fa- Output: sh: syntax error: unterminated quoted string
# syntax=docker/dockerfile:1 FROM node:22.22.3-alpine3.23 AS builder WORKDIR /work # Copy repository into the builder image COPY . . # Build the Font Awesome Free package (install dependencies) RUN cd js-packages/@fortawesome/fontawesome-free && npm install FROM node:22.22.3-alpine3.23 WORKDIR /app # Copy built assets from the builder stage COPY --from=builder /work/js-packages/@fortawesome/fontawesome-free /app/fontawesome-free # Install a lightweight static file server for runtime access RUN apk add --no-cache curl RUN npm install -g http-server EXPOSE 8080 # Serve the assets directory at the root so URLs like /fontawesome-free/... work CMD ["http-server", "/app", "-p", "8080"]
# Multi-stage Dockerfile for Font Awesome Free package in this repo FROM node:22.22.3-alpine3.23 AS builder WORKDIR /work # Copy the repository into the builder stage COPY . . # Build/install dependencies for the fontawesome-free package RUN cd js-packages/@fortawesome/fontawesome-free && npm install FROM node:22.22.3-alpine3.23 # Runtime image WORKDIR /app # Copy the built assets from the builder stage COPY --from=builder /work/js-packages/@fortawesome/fontawesome-free /app/fontawesome-free # Install a lightweight static file server to serve the assets RUN npm install -g http-server EXPOSE 8080 # Serve the Font Awesome Free package assets CMD ["http-server", "/app/fontawesome-free", "-p", "8080"]
# Deny files and directories that should not be in the image node_modules .git .gitignore Dockerfile .dockerignore README.md CHANGELOG.md UPGRADING.md *.log # Optional: cache and build artifacts build dist
Concerns: The build relies on npm install inside a subpath; CI must allow network access to npm registry., The runtime currently serves static assets via http-server; there is no explicit health endpoint, so smoke tests rely on inspecting a CSS file rather than a dedicated health check. Smoke [FAIL]: sh -c 'http-server /app/fontawesome-free -p 8080 & SERVER=$!; sleep 2; curl -fsS http://localhost:8080/css/all.min.css | grep -q Font; RES=$?; kill $SERVER; exit $RES Output: sh: syntax error: unterminated quoted string
# Multi-stage Dockerfile for Font Awesome Free package in this repo FROM node:22.22.3-alpine3.23 AS builder WORKDIR /work # Copy the repository into the builder stage COPY . . # Build/install dependencies for the fontawesome-free package RUN cd js-packages/@fortawesome/fontawesome-free && npm install FROM node:22.22.3-alpine3.23 # Runtime image WORKDIR /app # Copy the built assets from the builder stage COPY --from=builder /work/js-packages/@fortawesome/fontawesome-free /app/fontawesome-free # Install a lightweight static file server to serve the assets RUN npm install -g http-server EXPOSE 8080 # Serve the Font Awesome Free package assets CMD ["sh", "-lc", "http-server /app/fontawesome-free -p 8080"]
Smoke [PASS]: grep -q 'url(../webfonts' /app/fontawesome-free/css/*.css Smoke [PASS]: grep -q 'Font Awesome Free' /app/fontawesome-free/css/*.css