scoresaber-reloaded-v2/Dockerfile

40 lines
971 B
Docker
Raw Normal View History

2023-10-19 14:17:55 +01:00
FROM fascinated/docker-images:node-latest AS base
# Install depends
FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json* package-lock.yaml* ./
2023-10-19 14:21:29 +01:00
RUN npm install --frozen-lockfile --quiet
2023-10-19 14:17:55 +01:00
# Build from source
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
ENV NEXT_TELEMETRY_DISABLED 1
2023-10-19 14:20:01 +01:00
RUN npm run build
2023-10-19 14:17:55 +01:00
# Run the app
FROM base AS runner
WORKDIR /app
ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
RUN mkdir .next
RUN chown nextjs:nodejs .next
COPY --from=builder --chown=nextjs:nodejs /app/node_modules ./node_modules
COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/package.json ./package.json
USER nextjs
EXPOSE 80
ENV HOSTNAME "0.0.0.0"
ENV PORT 80
2023-10-19 14:20:01 +01:00
CMD ["npm", "run", "start"]