File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11FROM node:20-alpine
22
3+ RUN apk add --no-cache su-exec
4+
35WORKDIR /app
46ENV NODE_ENV=production
57
68COPY package*.json ./
79RUN npm ci --omit=dev
810
911COPY . .
10- RUN mkdir -p /app/public/images && chown -R node:node /app
11-
12- USER node
12+ RUN mkdir -p /app/public/images && chown -R node:node /app \
13+ && chmod +x /app/docker-entrypoint.sh
1314
1415EXPOSE 3000
1516HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
1617 CMD wget -qO- http://localhost:3000/image/health || exit 1
18+ ENTRYPOINT ["/app/docker-entrypoint.sh" ]
1719CMD ["npm" , "start" ]
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ set -e
3+
4+ # Fix volume permissions: ensure node user can write to images directory
5+ if [ -d /app/public/images ]; then
6+ chown -R node:node /app/public/images 2> /dev/null || true
7+ fi
8+
9+ # Run the main process as node user
10+ exec su-exec node " $@ "
You can’t perform that action at this time.
0 commit comments