# https://github.com/vercel/next.js/tree/canary/examples/with-docker
FROM node:16-alpine
WORKDIR /app

ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

USER nextjs

COPY entrypoint.sh ./entrypoint.sh
COPY next.config.js ./next.config.js
COPY --chown=nextjs:nodejs public ./public
COPY package.json ./package.json

COPY --chown=nextjs:nodejs .next/standalone ./
COPY --chown=nextjs:nodejs .next/static ./.next/static

EXPOSE 3000

ENV PORT 3000

CMD ["sh", "entrypoint.sh"]
