One page

Docker and deployment cheat sheet

What to keep at hand. If a line is not clear, go back to the matching lesson in the course.

Open the course: Docker and deployment

Docker

WhatHow
Build an imagedocker build -t api .
Rundocker run -p 3000:3000 --env-file .env api
Start everythingdocker compose up -d
Logsdocker compose logs -f api
Stopdocker compose down

Deploy and CI

WhatHow
Portapp.listen(process.env.PORT ?? 3000)
Migrationsnpx prisma migrate deploy
Checksnpm ci && npm run lint && npx tsc --noEmit && npm test

Containers and production

WhatHow
Enter a containerdocker exec -it api sh
Container logsdocker logs -f api
Build stageCOPY --from=build /app/dist ./dist
No rootUSER node
Proxy with HTTPSapi.example.com { reverse_proxy localhost:3000 }