Skip to content

Commit b098365

Browse files
committed
Add Docker as deploy platform
Add presence of Docker-related commands in a "Deployment" (or similar) section of README as likely deploy target / platform
1 parent 5cdfacd commit b098365

4 files changed

Lines changed: 51 additions & 0 deletions

File tree

hdi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,6 +1437,7 @@ detect_platforms_from_commands() {
14371437
cdk) _platform_add "awscdk" "AWS CDK" "high" ;;
14381438
dokku) _platform_add "dokku" "Dokku" "high" ;;
14391439
surge) _platform_add "surge" "Surge" "high" ;;
1440+
docker|docker-compose|podman) _platform_add "docker" "Docker" "high" ;;
14401441
esac
14411442
done
14421443
}
@@ -1464,6 +1465,7 @@ detect_platforms_from_prose() {
14641465
if [[ "$body" =~ DigitalOcean ]]; then _platform_add "digitalocean" "DigitalOcean" "low"; fi
14651466
if [[ "$body" =~ Kamal ]]; then _platform_add "kamal" "Kamal" "low"; fi
14661467
if [[ "$body" =~ Surge ]]; then _platform_add "surge" "Surge" "low"; fi
1468+
if [[ "$body" =~ Docker ]]; then _platform_add "docker" "Docker" "low"; fi
14671469
shopt -u nocasematch
14681470
done
14691471
}

src/platform.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ detect_platforms_from_commands() {
8989
cdk) _platform_add "awscdk" "AWS CDK" "high" ;;
9090
dokku) _platform_add "dokku" "Dokku" "high" ;;
9191
surge) _platform_add "surge" "Surge" "high" ;;
92+
docker|docker-compose|podman) _platform_add "docker" "Docker" "high" ;;
9293
esac
9394
done
9495
}
@@ -116,6 +117,7 @@ detect_platforms_from_prose() {
116117
if [[ "$body" =~ DigitalOcean ]]; then _platform_add "digitalocean" "DigitalOcean" "low"; fi
117118
if [[ "$body" =~ Kamal ]]; then _platform_add "kamal" "Kamal" "low"; fi
118119
if [[ "$body" =~ Surge ]]; then _platform_add "surge" "Surge" "low"; fi
120+
if [[ "$body" =~ Docker ]]; then _platform_add "docker" "Docker" "low"; fi
119121
shopt -u nocasematch
120122
done
121123
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# express-api
2+
3+
A containerized Express API.
4+
5+
## Install
6+
7+
```bash
8+
npm install
9+
```
10+
11+
## Deployment
12+
13+
Build the Docker image and push to the container registry:
14+
15+
```bash
16+
docker build -t express-api .
17+
docker push ghcr.io/acme/express-api:latest
18+
```

test/hdi.bats

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1613,3 +1613,32 @@ assert all(p['confidence'] == 'high' for p in platforms), 'expected all high con
16131613
[ "$status" -eq 0 ]
16141614
[[ "$output" != *"Vercel"* ]]
16151615
}
1616+
1617+
@test "platform: Docker detected from deploy section commands" {
1618+
run "$HDI" deploy --ni "$FIXTURES/platform-docker"
1619+
[ "$status" -eq 0 ]
1620+
[[ "$output" == *"deploy → Docker"* ]]
1621+
[[ "$output" != *"Docker?"* ]]
1622+
}
1623+
1624+
@test "platform: Docker CLI tool detection" {
1625+
run "$HDI" deploy --ni "$FIXTURES/platform-docker"
1626+
[ "$status" -eq 0 ]
1627+
[[ "$output" == *"docker build"* ]]
1628+
[[ "$output" == *"docker push"* ]]
1629+
}
1630+
1631+
@test "platform: Docker json output" {
1632+
run "$HDI" --json "$FIXTURES/platform-docker"
1633+
[ "$status" -eq 0 ]
1634+
echo "$output" | python3 -c "
1635+
import json,sys
1636+
d=json.load(sys.stdin)
1637+
platforms = d['platforms']
1638+
names = [p['name'] for p in platforms]
1639+
assert 'Docker' in names, f'expected Docker in {names}'
1640+
dk = [p for p in platforms if p['name'] == 'Docker'][0]
1641+
assert dk['confidence'] == 'high', f'expected high confidence, got {dk[\"confidence\"]}'
1642+
assert dk['group'] == 'docker'
1643+
"
1644+
}

0 commit comments

Comments
 (0)