One mental model
A Dockerfile is a recipe for your app image. It starts from a base image, adds your app files, installs dependencies, documents the port, and sets the start command.
What goes inside
Docker reads the Dockerfile from top to bottom. Each line should make the app closer to being runnable on another laptop.
For a beginner web app, keep it boring. Pick the runtime image, set a working folder, copy files, install packages, and set the command that starts the server.