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 deploymentDocker
| What | How |
|---|---|
| Build an image | docker build -t api . |
| Run | docker run -p 3000:3000 --env-file .env api |
| Start everything | docker compose up -d |
| Logs | docker compose logs -f api |
| Stop | docker compose down |
Deploy and CI
| What | How |
|---|---|
| Port | app.listen(process.env.PORT ?? 3000) |
| Migrations | npx prisma migrate deploy |
| Checks | npm ci && npm run lint && npx tsc --noEmit && npm test |
Containers and production
| What | How |
|---|---|
| Enter a container | docker exec -it api sh |
| Container logs | docker logs -f api |
| Build stage | COPY --from=build /app/dist ./dist |
| No root | USER node |
| Proxy with HTTPS | api.example.com { reverse_proxy localhost:3000 } |