Building and deploying Next.js applications with Docker
Ғылым және технология
Did you miss the Docker Community All-Hands on March 31st, 2022?
Here is a replay of the talk hosted by Armagan Amcalar (@dashersw): Building and deploying Next.js applications with Docker.
► Description: Next.js is a popular choice when it comes to building server-side rendered frontend applications with React. With static site generation and an extensive suite of development tools, Next.js offers an end-to-end solution. In this talk, Armagan will go over the steps you need to follow to use Next.js in Docker to enable a consistent development and deployment experience, including the development of Docker images for local application development and highly optimized production Docker images for deployment.
🐳 Join our community on Slack: dockr.ly/slack
You can follow Docker on social networks:
► Twitter: / docker
► LinkedIn: / docker
► Facebook: / docker.run
Пікірлер: 43
Very very good! Thank you so much! Very didact and detailed. I've learned a lot!
Precise and concise explanation... Thank you very much.
Informative and clear! Cheers!
Thank you! It was very helpful and I like the way you teach!
Hi. It was really the best video I saw for that matter in last time. Thanks :)
Thank you for this amazing presentation, pretty concise and informative! 🎉
Amazing! Finally I know what am I doing! Very important for me was to watch that video to the end, where u explain Dockerfile from NextJS documentation ;))
Thank you for the video, very didatic and detailed, nice concepts and informative contents for us. Really really good!
Thank you sir, just another question, how do I config to change default port 3000 to 4200 of the container? Do I need to create a server.js file?
It would be nice to have source code as well 🙂
Informative and concise. Loved it! :) thanks!
Fantastic work!
thanks for the videos guys
Thanks a lot for this man
Thanks. What if we want to use it with nginx?
Thanks, worked for me.
how do i build and deploy a next js with node app with docker?
Do we have a video for next steps to take this to next level on aws for prod as well?
Does the Nextjs Image component run well on prod?
Hi Armagan! Thank you for this amazing presentation! When use command docker-compose -f docker-compose.production.yml up --build --force-recreate I get errors in my application that are not present when building locally: 1. Type error: Cannot find module '../components/Heading' or its corresponding type declarations. #0 8.843 > 4 | import Heading from "../components/Heading"; 2. failed to solve: executor failed running [/bin/sh -c npm run build]: exit code: 1 Please tell me how to fix it?
@thatsalot3577
Жыл бұрын
It happened because you didn't copied the components folder which has a file Heading, But you imported this file in your pages folder If you're creating a components folder make sure to copy it in the dockerfile just like you copied pages folder. COPY components ./components
Where is the deploying part? localhost is not deployment.
Hi Armagan, when use command docker-compose -f docker-compose.production.yml up --build --force-recreate ERROR: The Compose file is invalid because: Service app has neither an image nor a build context specified. At least one must be provided.
@jowarren7211
2 жыл бұрын
I ran into this too and added "context: . " in the compose under the build field
@nileshchaudhari843
2 жыл бұрын
@@jowarren7211 Thanks it works
In development ssr no work, getServerSideProps :(
Bir kere daha astık bayrakları 😇 Eline sağlık Armağan!
links to source code or snippit you copy pasted?
8:01 i was surprised on the text can change suddenly, it seems like you edit and save on the other screen?
@raajnadar
2 жыл бұрын
Hot reloading
if you're using typescript consider removing the NODE_ENV=production from the first stage of Dockerfile.production
@jeffinj7707
2 жыл бұрын
can you share why? thanks
@peterdshekiondo9444
Жыл бұрын
am not sure why but in my initial build, the site was rendering a blank page. But this resolved it.
sorry, but where is the deploying part?
Yes but How do we run in different environments? Say Dev, STG, QA, Prod, where each environment needs its own config variables? Can we use one image for each different environment? (and how do we configure the envionment variables to use to use with this approach) Or do we need to build a seperate image for each environment? (and how do we configure the envionment variables to use with this approach)
@secret-alias
2 жыл бұрын
I'm no expert but I would imagine in your CI/CD process, when you run docker build you could pass in your variables to either run a different build if that's what you need, or to build once and use the variables if they don't affect the build if that's what you need. I think that's entirely down to your own requirements. If it affects the build, then different images, if not, then just pass the variables straight through to the application.
Can you please post the source to GitHub
@en_kratia
8 ай бұрын
Link in the end of the video?
there’s a famous quote that says : talk is cheap, show me the code 😅
13:33
these presentations are useless without submitting your code to a public repo
Why do you have install additional package "yarn", if you have already installed npm with node by default? What the point ?
@ryostyles9904
7 ай бұрын
Yarn is basically faster than npm, so a lot of people prefer yarn. It's quite like how a lot of people use axio instead of the built in fetch api