This repository has been archived on 2024-10-29. You can view files and clone it, but cannot push or open issues or pull requests.
scoresaber-reloadedv3/Dockerfile

52 lines
1.1 KiB
Docker
Raw Normal View History

2024-09-12 13:05:07 +01:00
FROM fascinated/docker-images:nodejs_20_with_pnpm AS base
2024-09-11 15:48:18 +01:00
# Install depends
FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json* pnpm-lock.yaml* ./
RUN pnpm install --frozen-lockfile --quiet
# Build from source
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
2024-09-23 23:53:07 +01:00
ENV NEXT_TELEMETRY_DISABLED=1
2024-09-11 15:48:18 +01:00
2024-09-13 20:54:34 +01:00
# Add the commit hash
ARG GIT_REV
2024-09-23 23:53:07 +01:00
ENV GIT_REV=${GIT_REV}
2024-09-13 20:54:34 +01:00
2024-09-11 15:48:18 +01:00
# Build the app
RUN pnpm run build
# Run the app
FROM base AS runner
WORKDIR /app
2024-09-23 23:53:07 +01:00
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
2024-09-11 15:48:18 +01:00
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
RUN mkdir .next
RUN chown nextjs:nodejs .next
2024-09-24 10:53:03 +01:00
# Add the commit hash
ARG GIT_REV
ENV GIT_REV=${GIT_REV}
2024-09-23 23:30:04 +01:00
COPY --from=builder --chown=nextjs:nodejs /app/node_modules ./node_modules
2024-09-11 15:48:18 +01:00
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
2024-09-11 15:52:25 +01:00
COPY --from=builder --chown=nextjs:nodejs /app/next.config.mjs ./next.config.mjs
2024-09-11 15:48:18 +01:00
USER nextjs
2024-09-24 10:37:30 +01:00
EXPOSE 3000
2024-09-23 23:57:45 +01:00
CMD ["pnpm", "start"]