mirror of
https://github.com/decolua/9router.git
synced 2026-05-08 12:01:28 +00:00
* [fix] macos * chore: clean up .gitignore by removing unnecessary start.sh entry --------- Co-authored-by: lokinh <locnh@uniultra.xyz>
40 lines
1.2 KiB
Docker
40 lines
1.2 KiB
Docker
FROM node:20-alpine AS builder
|
|
WORKDIR /app
|
|
|
|
COPY package*.json ./
|
|
RUN if [ -f package-lock.json ]; then npm ci --no-audit --no-fund; else npm install --no-audit --no-fund; fi
|
|
|
|
COPY . ./
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
RUN npm run build
|
|
|
|
FROM node:20-alpine AS runner
|
|
WORKDIR /app
|
|
|
|
LABEL org.opencontainers.image.title="9router"
|
|
|
|
ENV NODE_ENV=production
|
|
ENV PORT=20128
|
|
ENV HOSTNAME=0.0.0.0
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
|
|
COPY --from=builder /app/public ./public
|
|
COPY --from=builder /app/.next/static ./.next/static
|
|
COPY --from=builder /app/.next/standalone ./
|
|
COPY --from=builder /app/open-sse ./open-sse
|
|
# Next file tracing can omit sibling files; MITM runs server.js as a separate process.
|
|
COPY --from=builder /app/src/mitm ./src/mitm
|
|
# Standalone node_modules may omit deps only required by the MITM child process.
|
|
COPY --from=builder /app/node_modules/node-forge ./node_modules/node-forge
|
|
|
|
RUN mkdir -p /app/data
|
|
|
|
# Fix permissions at runtime (handles mounted volumes)
|
|
RUN printf '#!/bin/sh\nchown -R node:node /app/data 2>/dev/null; exec su-exec node "$@"\n' > /entrypoint.sh && chmod +x /entrypoint.sh
|
|
RUN apk add --no-cache su-exec
|
|
|
|
EXPOSE 20128
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
CMD ["node", "server.js"]
|