How to self host a Next.js application (with Dockerfile overview)

Sdílet
Vložit
  • čas přidán 29. 08. 2024
  • link to my file github.com/web...
    Become a YT Members to get extra perks!
    / @webdevcody
    My Products
    🏗️ WDC StarterKit: wdcstarterkit.com
    📖 ProjectPlannerAI: projectplanner...
    🤖 IconGeneratorAI: icongeneratora...
    Useful Links
    💬 Discord: / discord
    🔔 Newsletter: newsletter.web...
    📁 GitHub: github.com/web...
    📺 Twitch: / webdevcody
    🤖 Website: webdevcody.com
    🐦 Twitter: / webdevcody

Komentáře • 49

  • @loorinho
    @loorinho Před měsícem +5

    I love these kind of videos. Short and concise to the point focusing on one thing. Much love from Uganda "Mentor"

  • @blizzy78
    @blizzy78 Před měsícem +3

    thanks for mentioning the memory allocator issue, I totally missed that in the docs when I was building my apps

  • @ricko13
    @ricko13 Před měsícem +6

    im not gonna watch the video right now, but here is your like Cody 👍

  • @shockgalaxy9849
    @shockgalaxy9849 Před měsícem +1

    Just when I started thinking about using railway with next you drop this banger. Thanks a lot

  • @alonsoalarconaguilar7113
    @alonsoalarconaguilar7113 Před měsícem +1

    Very helpful video, providing an application for my day to day job makes me want to learn Docker 👍

  • @ahmedjaber8595
    @ahmedjaber8595 Před měsícem +3

    i can't work without docker anymore
    thanks for the video

  • @NaniwaRocky
    @NaniwaRocky Před měsícem +1

    Yesss was waiting for this!

  • @andreh.9300
    @andreh.9300 Před měsícem +1

    Super useful video! Thank you!

  • @clayton.schneider
    @clayton.schneider Před měsícem +2

    Definitely interested when/if you get that sharp portion figured out

    • @WebDevCody
      @WebDevCody  Před měsícem

      I tried for another hour. I can’t get this container to correctly work with tunnels when using alpine. It’s like the dns breaks in railway when using alpine. If I wasn’t using tunnels I’m pretty sure you just need to use alpine image and install lib6c like they do in their example.

    • @damjandjordjevic1994
      @damjandjordjevic1994 Před měsícem

      @@WebDevCody don't the binaries need to be compiled with the musl compiler if you wanna run them on a musl system?
      Maybe you could look at void linux docs, as they seem to explain some of this musl stuff that I can't seem to comprehend :D

  • @SeibertSwirl
    @SeibertSwirl Před měsícem +3

    Good job babe!!!

  • @MightyMoud
    @MightyMoud Před měsícem +25

    Triangle company hiding standalone to make sure service cost stay high

    • @justinleong3967
      @justinleong3967 Před měsícem +3

      Triangle company 😂

    • @sandip_1698
      @sandip_1698 Před měsícem

      😂😂😂😂😂

    • @everythingnaruto5682
      @everythingnaruto5682 Před měsícem +2

      it's literally there in the docs, and they mention it's good for docker or self hosting.

    • @rand0mtv660
      @rand0mtv660 Před měsícem +6

      It's not hidden at all when it comes to deploying examples. I also dislike some things Vercel does, but spreading false information like this is also not correct thing to do.

  • @jd_27
    @jd_27 Před měsícem

    thank you Cody

  • @tsykin
    @tsykin Před 21 dnem

    This was very helpful for me to understand self-hosting Next.js!
    I am also curious what's your average bill for project with postgres and nextjs app?

  • @patolorde
    @patolorde Před měsícem

    Great content 👍🤙

  • @amershboul9107
    @amershboul9107 Před měsícem

  • @anonAcc575
    @anonAcc575 Před měsícem +2

    Docker is amazing when it works, but when changing something, debugging issues can be really frustrating.

  • @gold-junge91
    @gold-junge91 Před měsícem

    ❤ Nice!! Thanks for that i have not look in too. Deploy with docker but i get for 3 days the same shit error with GitHub actions, so no i try it with docker over GitHub actions 😅 thank you

    • @WebDevCody
      @WebDevCody  Před měsícem

      Be careful not to put sensitive arguments when using the ARGS in your doctor file. The doctor documentation warns that you could legal your private building on a public repository you get up actions.

  • @boyo_23
    @boyo_23 Před měsícem

    12:00 glibc is the C standard library for most Linux systems. musl is a lightweight alternative to glibc.

  • @giantseaturtle
    @giantseaturtle Před měsícem

    Thank you.

  • @Mirislomovmirjalol
    @Mirislomovmirjalol Před měsícem +1

    Have you tried configuring next_public env variables for static pages with docker? I had a lot of issues with that, and couldn’t figure it out. Then i put env keys on docker image (no sensitive data). Unfortunately, on next js, ssr pages and static pages read env keys differently, and i don’t have solution for that

  • @kevins7621
    @kevins7621 Před 7 dny

    Thanks, how to you deal with env variables when using Docker self host?

  • @MiadVosoughi
    @MiadVosoughi Před měsícem

    I remember there was some issues when you want to scale the app by deploying to multiple pods. Not sure if that’s been documented now

  • @OniTemitope-cm9lu
    @OniTemitope-cm9lu Před měsícem

    Whats that VScode theme ??, looks sickk

  • @kritsrijakkot9175
    @kritsrijakkot9175 Před měsícem

    When I use docker compose to build app have database and app connection inside. The landing page so slow I don't know because of something but I think database query from docker image database slow or GPU and CPU on Docker Desktop not enough (my nextapp image size 1.2 GB). How to solve this problem? When using everything on local macbook is so fast.

  • @farzadmf
    @farzadmf Před měsícem

    I'm really curious to know if the built-in server used to serve the Website (by doing `node server.js`) is powerful and robust enough to handle a high load of requests.

  • @antidegenerates7449
    @antidegenerates7449 Před měsícem

    Single thread? How you manage restarts?

  • @satyak1337
    @satyak1337 Před 21 dnem

    what is the size of docker file?

  • @chillydill4703
    @chillydill4703 Před měsícem

    About the memory issue, running an SQL-instance will always eat up as much memory as it can due to caching over time etc, at least for MS SQL, not sure about SQLite but could be worth checking out. So I always set a memory limit for the SQL instance.

  • @ahouse73
    @ahouse73 Před měsícem

    I like the idea of using dev containers for development, first of, whats youre opinion on this and can you maybe make a video about it ? For me (beginner) the hot reload just took like 30s or so, this is why I dropped it, but wonder if I did somethig wrong

    • @WebDevCody
      @WebDevCody  Před měsícem

      I only use containers for dependencies such as the database localy

    • @ahouse73
      @ahouse73 Před měsícem

      @@WebDevCody what do you dislike about it ? And can you maybe try it, maybe you even like it :)
      I think the idea is pretty smart to install everything just in those containers and develop in those

    • @WebDevCody
      @WebDevCody  Před měsícem

      @@ahouse73 I want to make sure we are talking about the same thing. You mean use a docker compose file and volume mount your code inside the container and run your dev server inside the container right?

    • @ahouse73
      @ahouse73 Před měsícem

      @@WebDevCody yes

  • @shaked1233
    @shaked1233 Před měsícem

    What are the advantages of railway on aws for nextjs app?

  • @sahagarzoumanian7151
    @sahagarzoumanian7151 Před měsícem

    What are the benefits of hosting a Next.js app through a docker container rather than vercel?

    • @WebDevCody
      @WebDevCody  Před měsícem

      Cheaper, you can setup a websocket server if you want, can do in memory rate limiting, no risk of high bills if ddosed, using something like prisma or dependencies that require binaries will work no problem vs serverless is a pain

  • @sledge_remirth
    @sledge_remirth Před měsícem +1

    I think T3 documentation suggests using standalone for Docker so I never really tried anything else.
    Crazy if that option is available and not prescribed as default for containerizing

    • @rand0mtv660
      @rand0mtv660 Před měsícem

      It's actually used in their official Docker example, so they are prescribing it for that exact use case.

  • @ardianhotii
    @ardianhotii Před měsícem

    How to do it when I jave 2 docker one for nextjs and one for a nodej express api that is the backend for the nextjs app , how to set the env for the api url in the nextjs dockerfile is it localhost or no