Production
We've made use of Vercel for our hosting, which are the maker of Next.js. They have an easy one click integration by linking your github to your Vercel account. Other hosting options are ofc also possible, but need a bit more configuring.
Dockerfile example
This is an example if you would like to host your app on another service provider:
FROM node:lts as dependencies
WORKDIR /my-project
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
FROM node:lts as builder
WORKDIR /my-project
COPY . .
COPY --from=dependencies /my-project/node_modules ./node_modules
RUN yarn build
FROM node:lts as runner
WORKDIR /my-project
ENV NODE_ENV production
# If you are using a custom next.config.js file, uncomment this line.
# COPY --from=builder /my-project/next.config.js ./
COPY --from=builder /my-project/public ./public
COPY --from=builder /my-project/.next ./.next
COPY --from=builder /my-project/node_modules ./node_modules
COPY --from=builder /my-project/package.json ./package.json
EXPOSE 3000
CMD ["yarn", "start"]