Last active
December 17, 2020 20:13
-
-
Save nilsandrey/f2bd69deeeca4e0b5c6843e5bf0a293d to your computer and use it in GitHub Desktop.
Dockerfile to containerize a Next.js app by @oliverjumpertz@twitter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node: 14-alpine as build | |
ENV NEXT_TELEMETRY_DISABLED=1 | |
RUN apk add --no-cache libc6-compat | |
WORKDIR /app | |
COPY .. | |
RUN yarn install && \ | |
yarn build | |
FROM node: 14-alpine | |
ENV NEXT_TELEMETRY_DISABLED=1 | |
WORKDIR /app | |
COPY --from=build /app/package.json /app/yarn.lock /app/next.config.js | |
COPY --from=build /app/node_modules/ ./node_modules | |
COPY --from=build /app/.next/ ./.next | |
RUN addgroup -g 1001 -S node js && \ | |
adduser -S next js -u 1001 | |
USER nextjs | |
EXPOSE 3000 | |
ENTRYPOINT ["yarn" , "start"] |
Right! Fixed, thanks.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for sharing! Seems you missed the underscores in the env var though :)