Build a CRUD API with Docker Node.JS Express.JS & PostgreSQL

Поділитися
Вставка
  • Опубліковано 19 лис 2024

КОМЕНТАРІ • 46

  • @Smoljames
    @Smoljames  Рік тому +16

    Here's a breakdown of each of the Dockerfile commands :) also don't mind the buggy facecam at the end of the video lol
    FROM - specifies the base image for the Docker image you are creating. All subsequent instructions in the Dockerfile will be applied on top of this base image.
    WORKDIR - sets the working directory for any subsequent instructions that follow it in the Dockerfile. This is where commands like RUN and COPY will be executed.
    COPY - copies files or directories from the host machine to the Docker image. The first argument is the path to the file or directory on the host machine, and the second argument is the destination path in the Docker image.
    RUN - executes a command in the Docker image. This can be used to install packages, run build commands, and do other tasks required to configure the image.
    EXPOSE - documents the ports that the Docker image is expected to listen on when it is run. It does not actually publish the ports.
    CMD - specifies the command to run when the Docker container is started from the image. If the Docker container is started with a command-line argument, it will override the CMD instruction. There can only be one CMD instruction in a Dockerfile, and it should be the last instruction.

  • @СергейДехтярёв-ъ4н

    Damn, I've never seen this Docker configuration. I've started learning backdev recently and the amount of project configurations is just mindblowing. It's really easy to get lost in this whole ocean of information

    • @Smoljames
      @Smoljames  Рік тому +3

      Yea I feel you my friend! Just have to find the configurations you like and keep with them :)

    • @vladislav_artyukhov
      @vladislav_artyukhov 5 місяців тому

      Docker configs is easy, actually. You really most time googling a ready solutions and modify/cobine by the need

  • @tunisiasparx2105
    @tunisiasparx2105 4 місяці тому +1

    aswome , best rich example in minutes, dude your amazing , you just clarify everything as you go !
    thx

  • @VanderleiRobertoMoretto
    @VanderleiRobertoMoretto Місяць тому

    Simple, fast, direct ! Good job!

  • @AlexanderPoznanski
    @AlexanderPoznanski Місяць тому

    Thank you! Easy explained about using integration with database and with creating and checking what's going on with using Docker image! Additional thanks about details with port forwarding from outside to inside.

  • @programandocomandersonsouza
    @programandocomandersonsouza 9 місяців тому +1

    Very good. Congratulation Smoljames.

  • @SpicyTysonM
    @SpicyTysonM 13 днів тому

    Very on point and shoulrt and sweet. Thanks man. What is your vscode color theme btw ? Looks clean...

  • @rwayneleon7481
    @rwayneleon7481 5 місяців тому +1

    Great job. it really helped! Thank you

  • @jindrichknedla7406
    @jindrichknedla7406 Рік тому +1

    Great tutorial. Really helped! Thank you

  • @yatharthm22
    @yatharthm22 4 місяці тому +2

    now in the same project can you please add kubernetes connectivity too?

  • @walterandrade4273
    @walterandrade4273 Рік тому +1

    great tutorial, thank you

    • @Smoljames
      @Smoljames  Рік тому +1

      Thanks for the comment :)

  • @danilsyah4108
    @danilsyah4108 9 місяців тому +1

    thanks a lot , great tutorial

    • @Smoljames
      @Smoljames  9 місяців тому

      Cheers broski :P

  • @muhammadmasood3830
    @muhammadmasood3830 2 місяці тому

    Helpfull tutorial❤

  • @velkb228
    @velkb228 3 місяці тому

    thanks bro, you rock

  • @AlexanderPoznanski
    @AlexanderPoznanski Місяць тому

    I'd like to know/watch a solution how to prepare Docker image if I don't have Docker installed on my computer, but it is installed on a server and my devOps knows how to operate with Docker images, but I need to incorporate using of Docker image in a project as a developer. And once again, dev machine is working on one operating system, though server machine is working on different one. What should I consider for?

  • @sammed.sankonatti
    @sammed.sankonatti 9 місяців тому +2

    Is this the way to create tables inside docker container of postgres ??
    What is the better and industry standard way ? Please explain

    • @Smoljames
      @Smoljames  9 місяців тому

      There are numerous ways you can do it - this is just one. Another is to boot up the docker container and run a terminal command from within, and another is to execute a script that does an equivalent functionality.

    • @sammed.sankonatti
      @sammed.sankonatti 9 місяців тому

      @@Smoljames Thank you

  • @pshycocoder
    @pshycocoder 2 місяці тому

    which vscode theme u r using?

  • @krsnyder128
    @krsnyder128 Місяць тому

    In the Dockerfile, could you also run "COPY . ." on line 5 instead and then "RUN npm install"? That would copy everything including the package*.json files and they are going to the same location.
    From what I can see there's no benefit in copying the json files, installing the packages, and then having to copy the rest of the project files, but maybe I misunderstand

    • @uvaishassan
      @uvaishassan 17 днів тому

      I think it is to prevent copying the node_modules folder, which will be huge in size.

  • @prashlovessamosa
    @prashlovessamosa Рік тому +1

    Thanks.

  • @hnvahid
    @hnvahid 10 місяців тому +1

    Thanks

    • @Smoljames
      @Smoljames  10 місяців тому

      You're welcome my broski :P

  • @Nate-yz2tv
    @Nate-yz2tv 9 місяців тому +1

    bro you saved me ty lol

  • @denyscole7382
    @denyscole7382 Рік тому +1

    Is there a specific reason for using commonjs modules over ES6 modules?

    • @Smoljames
      @Smoljames  Рік тому

      good question - there can definitely be advantages for using commonjs modules but in this video it was mostly just out of habit - ES6 is a great way to go if you prefer to do it that way though!

    • @denyscole7382
      @denyscole7382 Рік тому

      @@Smoljames Thank you for your response

  • @J3rist0
    @J3rist0 Рік тому +1

    If I wanted to connect my pgAdmin to the postgres on the container how would I do this? I've spent more time than I'd like to admit trying to get that to work but with no results. Help would me much appreciated.

    • @rpoursalimi
      @rpoursalimi 10 місяців тому +3

      You need to bind a port to your db. To do so, you can add "ports" to your db service.
      In another word, make the "docker-compose.yaml" look like this:
      version: "3"
      services:
      db:
      image: postgres
      environment:
      POSTGRES_PASSWORD: password123
      POSTGRES_USER: user123
      POSTGRES_DB: db123
      ports:
      - 13001:5432
      app:
      image: my-node-app
      ports:
      - 13000:3000
      Then rebuild and dock your app and db again by running the following commands in the terminal:
      docker system prune
      docker build -t my-node-app .
      docker-compose up
      Now, you should be able to connect to your database on port 13001 by using the respected settings and credentials.

    • @J3rist0
      @J3rist0 10 місяців тому +1

      @@rpoursalimi much appreciated

  • @satymshrma
    @satymshrma 2 місяці тому

    is it just me or does the video stop around 23:27?

  • @timlinator
    @timlinator Рік тому +1

    I can't find this code on your git hub

    • @Smoljames
      @Smoljames  Рік тому +1

      My apologies - link is here!
      github.com/jamezmca/docker-compose-example

    • @timlinator
      @timlinator Рік тому

      @@Smoljames Thanks

  • @sibbirshahriyar9742
    @sibbirshahriyar9742 Рік тому +1

    Noice

  • @AbhishekKumar-lp5rc
    @AbhishekKumar-lp5rc Рік тому

    Text size too small

    • @eduardoalvarez4457
      @eduardoalvarez4457 8 місяців тому

      nope, it looks just fine on a 24" screen (iMac M1 on my case)