feat(docker): add NEXT_PUBLIC_LOCAL_AUTH_TOKEN build arg for auto-login

This commit is contained in:
null 2026-05-19 22:30:21 -05:00
parent 72b873845f
commit a44dd1e219
1 changed files with 5 additions and 1 deletions

View File

@ -12,11 +12,13 @@ WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules COPY --from=deps /app/node_modules ./node_modules
COPY . ./ COPY . ./
# Allows configuring the API URL at build time. # Allows configuring the API URL and auth at build time.
ARG NEXT_PUBLIC_API_URL=auto ARG NEXT_PUBLIC_API_URL=auto
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL} ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
ARG NEXT_PUBLIC_AUTH_MODE ARG NEXT_PUBLIC_AUTH_MODE
ENV NEXT_PUBLIC_AUTH_MODE=${NEXT_PUBLIC_AUTH_MODE} ENV NEXT_PUBLIC_AUTH_MODE=${NEXT_PUBLIC_AUTH_MODE}
ARG NEXT_PUBLIC_LOCAL_AUTH_TOKEN
ENV NEXT_PUBLIC_LOCAL_AUTH_TOKEN=${NEXT_PUBLIC_LOCAL_AUTH_TOKEN}
RUN npm run build RUN npm run build
@ -25,11 +27,13 @@ WORKDIR /app
ENV NODE_ENV=production ENV NODE_ENV=production
ARG NEXT_PUBLIC_AUTH_MODE ARG NEXT_PUBLIC_AUTH_MODE
ARG NEXT_PUBLIC_LOCAL_AUTH_TOKEN
# If provided at runtime, Next will expose NEXT_PUBLIC_* to the browser as well # If provided at runtime, Next will expose NEXT_PUBLIC_* to the browser as well
# (but note some values may be baked at build time). # (but note some values may be baked at build time).
ENV NEXT_PUBLIC_API_URL=auto ENV NEXT_PUBLIC_API_URL=auto
ENV NEXT_PUBLIC_AUTH_MODE=${NEXT_PUBLIC_AUTH_MODE} ENV NEXT_PUBLIC_AUTH_MODE=${NEXT_PUBLIC_AUTH_MODE}
ENV NEXT_PUBLIC_LOCAL_AUTH_TOKEN=${NEXT_PUBLIC_LOCAL_AUTH_TOKEN}
# Create non-root user before COPY so --chown can reference it. # Create non-root user before COPY so --chown can reference it.
RUN addgroup -S appgroup && adduser -S -G appgroup appuser RUN addgroup -S appgroup && adduser -S -G appgroup appuser