|
3 | 3 | ## |
4 | 4 | ## This is our microservice for the users in an AB managed site. |
5 | 5 | ## |
| 6 | +## Security: image runs as non-root user (node). For production, prefer |
| 7 | +## pinning the base image by digest and overriding CMD to remove --inspect. |
| 8 | +## |
6 | 9 | ## Docker Commands: |
7 | 10 | ## --------------- |
8 | 11 | ## $ docker build -t digiserve/ab-user-manager:master . |
9 | 12 | ## $ docker push digiserve/ab-user-manager:master |
10 | 13 | ## |
| 14 | +## Multi-platform (M1/M2/M3 Mac → amd64 + arm64): |
| 15 | +## $ docker buildx create --use # once, if no builder |
| 16 | +## $ docker buildx build --provenance=true --sbom=true --platform linux/amd64,linux/arm64 -t digiserve/ab-user-manager:master --push . |
| 17 | +## Or use: $ DOCKER_ARGS="--platform linux/amd64,linux/arm64 --push" ./build.sh |
| 18 | +## Supply chain: use --provenance=true --sbom=true when pushing to a registry for Docker Hub attestations and license visibility. |
| 19 | +## |
11 | 20 |
|
12 | 21 | ARG BRANCH=master |
13 | 22 |
|
14 | 23 | FROM digiserve/service-cli:${BRANCH} |
15 | 24 |
|
| 25 | +# OCI labels for Docker Hub / Scout (license, description) |
| 26 | +LABEL org.opencontainers.image.title="User Manager" \ |
| 27 | + org.opencontainers.image.description="Microservice for managing users in an AB managed site" \ |
| 28 | + org.opencontainers.image.licenses="MIT" |
| 29 | + |
16 | 30 | COPY . /app |
17 | 31 |
|
18 | 32 | WORKDIR /app |
19 | 33 |
|
20 | | -RUN npm i -f |
| 34 | +# Reproducible install; use npm i -f only if npm ci fails (e.g. peer deps, git deps) |
| 35 | +RUN npm ci && npm cache clean --force |
21 | 36 |
|
22 | 37 | WORKDIR /app/AppBuilder |
23 | 38 |
|
24 | | -RUN npm i -f |
| 39 | +RUN npm ci && npm cache clean --force |
25 | 40 |
|
26 | 41 | WORKDIR /app |
27 | 42 |
|
| 43 | +# Security: run as non-root (base image should provide node user) |
| 44 | +RUN chown -R node:node /app |
| 45 | +USER node |
| 46 | + |
| 47 | +# --inspect=0.0.0.0:9229 exposes debugger to the network; omit in production or bind to 127.0.0.1 |
28 | 48 | CMD [ "node", "--inspect=0.0.0.0:9229", "app.js" ] |
0 commit comments