RESTfulMC/Frontend/Dockerfile

46 lines
1.1 KiB
Docker
Raw Permalink Normal View History

2024-04-21 08:08:52 -07:00
FROM imbios/bun-node AS base
2024-04-16 17:22:57 -07:00
# Install dependencies
FROM base AS depends
WORKDIR /usr/src/app
2024-04-21 08:08:52 -07:00
COPY package.json* bun.lockb* ./
RUN bun install --frozen-lockfile --quiet
2024-04-16 17:22:57 -07:00
# Build the app
FROM base AS builder
WORKDIR /usr/src/app
COPY --from=depends /usr/src/app/node_modules ./node_modules
COPY . .
ENV NEXT_TELEMETRY_DISABLED 1
2024-04-21 08:08:52 -07:00
RUN bun run build
2024-04-16 17:22:57 -07:00
# Run the app
FROM base AS runner
WORKDIR /usr/src/app
2024-04-21 08:10:30 -07:00
RUN addgroup --system --gid 1007 nextjs
RUN adduser --system --uid 1007 nextjs
2024-04-16 17:22:57 -07:00
RUN mkdir .next
RUN chown nextjs:nextjs .next
COPY --from=builder --chown=nextjs:nextjs /usr/src/app/node_modules ./node_modules
COPY --from=builder --chown=nextjs:nextjs /usr/src/app/.next ./.next
COPY --from=builder --chown=nextjs:nextjs /usr/src/app/public ./public
2024-04-19 22:58:13 -07:00
COPY --from=builder --chown=nextjs:nextjs /usr/src/app/docs ./docs
2024-04-16 17:22:57 -07:00
COPY --from=builder --chown=nextjs:nextjs /usr/src/app/next.config.mjs ./next.config.mjs
COPY --from=builder --chown=nextjs:nextjs /usr/src/app/package.json ./package.json
ENV NODE_ENV production
# Exposting on port 80 so we can
# access via a reverse proxy for Dokku
ENV HOSTNAME "0.0.0.0"
EXPOSE 80
ENV PORT 80
USER nextjs
2024-04-21 08:08:52 -07:00
CMD ["bun", "start"]