- /docker-smoke-test: prep, build, verify all Dockerfiles in a repo - /audit-repo-health: cross-repo pnpm/Docker/config consistency audit - /verify-all-backends: quick local typecheck+test+build (complement to /gitea-ci)
70 lines
2.1 KiB
Markdown
70 lines
2.1 KiB
Markdown
---
|
|
description: Docker smoke test — prep, build, and verify all Dockerfiles in the current repo
|
|
---
|
|
|
|
# Docker Smoke Test
|
|
|
|
Build and verify all Dockerfiles in the current product repo. Runs docker-prep, builds each image, then restores package.json files.
|
|
|
|
**Prerequisite:** Docker Desktop must be running. The current repo must have `scripts/docker-prep.sh`.
|
|
|
|
## 1. Identify the repo and its Dockerfiles
|
|
|
|
// turbo
|
|
|
|
```bash
|
|
REPO_DIR="$(pwd)"
|
|
REPO_NAME="$(basename "$REPO_DIR")"
|
|
echo "Repo: $REPO_NAME"
|
|
echo "Dockerfiles:"
|
|
find "$REPO_DIR" -maxdepth 2 -name "Dockerfile" -not -path "*/node_modules/*" | sort
|
|
```
|
|
|
|
## 2. Run docker-prep to pack @bytelyst/\* tarballs
|
|
|
|
```bash
|
|
bash scripts/docker-prep.sh
|
|
```
|
|
|
|
## 3. Build each Dockerfile
|
|
|
|
Build each Dockerfile found in the repo. The build context is always the repo root (`.`).
|
|
Tag images as `<service>:smoke-test` for easy cleanup.
|
|
|
|
For each Dockerfile found in step 1, run:
|
|
|
|
```bash
|
|
# Example for backend:
|
|
docker build -f backend/Dockerfile -t "$(basename $(pwd))-backend:smoke-test" . 2>&1 | tail -20
|
|
|
|
# Example for web:
|
|
docker build -f web/Dockerfile -t "$(basename $(pwd))-web:smoke-test" . 2>&1 | tail -20
|
|
```
|
|
|
|
Adapt the `-f` path based on actual Dockerfile locations from step 1.
|
|
If a build fails, stop and investigate the error before continuing.
|
|
|
|
## 4. Restore package.json files
|
|
|
|
```bash
|
|
bash scripts/docker-prep.sh --restore
|
|
```
|
|
|
|
## 5. Report results
|
|
|
|
Summarize which images built successfully and which failed.
|
|
If all passed, the repo's Docker setup is healthy.
|
|
|
|
## 6. (Optional) Cleanup smoke-test images
|
|
|
|
```bash
|
|
docker images --filter "reference=*:smoke-test" --format "{{.Repository}}:{{.Tag}}" | xargs -r docker rmi
|
|
```
|
|
|
|
## Common Failures
|
|
|
|
- **`.docker-deps` not found:** Run step 2 first, and ensure `.dockerignore` does NOT exclude `.docker-deps`
|
|
- **Google Fonts / TLS error:** Ensure `ENV NODE_TLS_REJECT_UNAUTHORIZED=0` is in the builder stage
|
|
- **Native module build failure:** Add `python3 make g++` to `RUN apt-get install` in the builder stage
|
|
- **`public/` not found:** Remove the `COPY public` line if the web app has no `public/` directory
|