scoresaber-reloaded-v2/Dockerfile

52 lines
1.2 KiB
Docker
Raw Normal View History

2023-11-08 06:19:10 +00:00
FROM fascinated/docker-images:node-pnpm-latest AS base
2023-10-19 13:17:55 +00:00
# Install depends
FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
2023-11-08 06:19:10 +00:00
COPY package.json* pnpm-lock.yaml* ./
2023-11-08 06:38:07 +00:00
RUN pnpm install --frozen-lockfile --quiet
2023-10-19 13:17:55 +00: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-20 11:04:29 +00:00
ARG GIT_REV
ENV GIT_REV ${GIT_REV}
2023-11-13 03:43:15 +00:00
ARG SENTRY_AUTH_TOKEN
ENV SENTRY_AUTH_TOKEN ${SENTRY_AUTH_TOKEN}
2023-11-07 23:11:59 +00:00
# Build the app
2023-11-08 06:19:10 +00:00
RUN pnpm run build
2023-10-19 13:17:55 +00:00
2023-11-07 23:11:59 +00:00
# Generate sitemap
2023-11-08 06:19:10 +00:00
RUN pnpm run generate-sitemap
2023-11-07 23:11:59 +00:00
2023-10-19 13:17:55 +00: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
2023-10-19 13:28:44 +00:00
COPY --from=builder --chown=nextjs:nodejs /app/next.config.js ./next.config.js
2023-11-07 23:05:11 +00:00
2023-10-19 13:17:55 +00:00
USER nextjs
EXPOSE 80
ENV HOSTNAME "0.0.0.0"
ENV PORT 80
2023-11-08 06:19:10 +00:00
CMD ["pnpm", "start"]