The build command and run command are essential for preparing and starting your application.
Overview
The build command and run command are essential for preparing and starting your application. These commands are executed inside the working directory and must be correctly defined to ensure the application runs smoothly.
The build command installs dependencies and compiles or prepares the application for execution.
The run command starts the application, making it available for requests.
Sometimes, additional commands need to be executed before starting the application. For example, running database migrations before launching the server. You can join multiple commands using &&, or simply place them on a new line, which automatically joins them with &&.
Running database migrations before starting the application
Django example
Or written on multiple lines:
Fastapi example (using alembic migrations)
Or written on multiple lines:
Conclusion
Setting the correct build command and run command ensures your application installs dependencies and starts correctly. Always verify these commands based on your application’s framework and dependencies.