Using Docker with Next.js (and Deploying with Google Cloud Run)

preview_player
Показать описание

0:00 — What is Docker?
0:25 — Relation to Kubernetes
0:45 — Installing Docker on your Machine
1:07 — Creating a Dockerfile
2:43 — Dockerignore
2:50 — Building the Docker Image
3:38 — Multi-stage Docker Builds
4:01 — Viewing Docker Images
4:41 — Setting up the Google Cloud SDK
5:23 — Creating a Project & Logging In
6:02 — Building Image with Google Cloud Build
6:30 — Deploying to Google Cloud Run
7:23 — Conclusion

Links
–––––
Command: npx create-next-app -e with-docker

–––––

#nextjs #docker
Рекомендации по теме
Комментарии
Автор

Probably the only docker nextjs that is well explained and dockerfile created as it was intended

bhupendrasinhthakre
Автор

There is even another very easy optimisation!
line 7: RUN yarn install --frozen-lockfile, change it to: RUN yarn install --frozen-lockfile --production
This leaves all devDependencies out of your installation. Just with the default NextJs app, it has eslint in it, when you leave that out it already saves another 23Mb!

jornejongsma
Автор

you are amazing, thanks for everything you do!

apaksimen
Автор

oh god
always great content with you !

marcdevoe
Автор

Digging the new thumbnail design Lee!🤙

fabianwolff
Автор

Im confused about 4 COPY lines in the docker file - if you had say a .env file, and other folders in the root, would you need to have a COPY command for all of them

CardinalHijack
Автор

Just yesterday I checked how to Dockerize the Next.js 😄

BurakSakall
Автор

Great tutorial, How much change this file with Next.js and Typescript?

OENRILER
Автор

Hello, thanks for the tutorial

am getting the error below.

failed to compute cache key: "/app/.next/static" not found: not found

kindly help me on what to do

bobherit
Автор

Docker is such a complete tool but also has too many things to learn about 😅 feels a bit overwhelming when you start using it

josesoto
Автор

NextJS has lots of static assets. How do you configure to serve them through CDN? I want to use docker for SSR only and nothing else.

ApoorvMote
Автор

Google cloud seems complex. Is it easy with Digitalocean?

surjithctly
Автор

How does this work with SSR and SSG? Since this runs within a Docker container, this wouldn't be deployed at the edge (Vercel) thus not supporting SSG? And since SSR relies on lambdas (serverless), how would that work?

rafaelhernandz
Автор

a point in build next app :
what's difference between build folder and .next folder?
is this true? i asked chatGPT :
said : the .next folder is used for dynamic build such as consider ssr - isr
but build folder is used for static build without ssr - isr, in other words like react app build (without serverside rendering)

what exactly these two build folder ?

thank you lee

esrafilelahi
Автор

Can we use nextjs with express server?

vigneshk
Автор

Thank you lee for this video. I just have one question.
Do all Next.js features works out of the box when deploying with Docker? especially the `revalidate` option?
And is there a way to mimic the Vercel's image optimization for local files, for DigitalOcean for example?

Yassinebridii
Автор

I am having a weird issue with the Docker image. Somehow my environment variables are not loading and thus throwing API key errors. After I expose my environment variables directly in the code the image runs without issue. Does anyone has a clue how I can fix this?

sanesanyo
Автор

Great. This could be considered CI/CD?

oxsvbrb
Автор

Fantastic brother..Please do with Azure devops

rambevara
Автор

But how I can see changes each time I made them ( HMR )?

alaeddinemenai
visit shbcf.ru