File size: 26,933 Bytes
76999ca | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 | [
{
"id": "sbd-0001",
"title": "Python image forgets requirements.txt",
"summary": "The Dockerfile installs from requirements.txt before that file exists inside the build context layer.",
"failure_type": "missing_build_context_file",
"ecosystem": "python",
"difficulty": "easy",
"tags": [
"dockerfile",
"python",
"build-context",
"pip"
],
"files": [
{
"path": "Dockerfile",
"content": [
"FROM python:3.12-slim",
"WORKDIR /app",
"COPY app.py .",
"RUN pip install --no-cache-dir -r requirements.txt",
"CMD [\"python\", \"app.py\"]"
]
},
{
"path": "requirements.txt",
"content": [
"flask==3.0.3"
]
},
{
"path": "app.py",
"content": [
"from flask import Flask",
"",
"app = Flask(__name__)",
"",
"@app.get(\"/\")",
"def home():",
" return {\"status\": \"ok\"}",
"",
"if __name__ == \"__main__\":",
" app.run(host=\"0.0.0.0\", port=8080)"
]
}
],
"failure_log": [
"Step 4/5 : RUN pip install --no-cache-dir -r requirements.txt",
"ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'"
],
"build": {
"command": "docker build -t sabnock/sbd-0001 ."
},
"verify": {
"commands": [
"docker build -t sabnock/sbd-0001 ."
]
},
"oracle_patch": [
"diff --git a/Dockerfile b/Dockerfile",
"--- a/Dockerfile",
"+++ b/Dockerfile",
"@@ -1,5 +1,6 @@",
" FROM python:3.12-slim",
" WORKDIR /app",
"-COPY app.py .",
"+COPY requirements.txt .",
" RUN pip install --no-cache-dir -r requirements.txt",
"+COPY app.py .",
" CMD [\"python\", \"app.py\"]"
],
"scoring": {
"must_touch": [
"Dockerfile"
],
"must_contain": [
{
"path": "Dockerfile",
"text": "COPY requirements.txt ."
}
],
"must_not_contain": []
},
"split": "seed"
},
{
"id": "sbd-0002",
"title": "Node image uses npm ci without a lockfile",
"summary": "The project has only package.json, but the Dockerfile uses npm ci, which requires a package-lock.json or npm-shrinkwrap.json.",
"failure_type": "lockfile_missing",
"ecosystem": "node",
"difficulty": "easy",
"tags": [
"dockerfile",
"node",
"npm",
"lockfile"
],
"files": [
{
"path": "Dockerfile",
"content": [
"FROM node:22-alpine",
"WORKDIR /app",
"COPY package.json .",
"RUN npm ci --omit=dev",
"COPY index.js .",
"CMD [\"node\", \"index.js\"]"
]
},
{
"path": "package.json",
"content": [
"{\"scripts\":{\"start\":\"node index.js\"},\"dependencies\":{\"express\":\"4.19.2\"}}"
]
},
{
"path": "index.js",
"content": [
"const express = require('express');",
"const app = express();",
"app.get('/', (_req, res) => res.json({status: 'ok'}));",
"app.listen(3000, '0.0.0.0');"
]
}
],
"failure_log": [
"npm ERR! code EUSAGE",
"npm ERR! The `npm ci` command can only install with an existing package-lock.json or npm-shrinkwrap.json."
],
"build": {
"command": "docker build -t sabnock/sbd-0002 ."
},
"verify": {
"commands": [
"docker build -t sabnock/sbd-0002 ."
]
},
"oracle_patch": [
"diff --git a/Dockerfile b/Dockerfile",
"--- a/Dockerfile",
"+++ b/Dockerfile",
"@@ -1,6 +1,6 @@",
" FROM node:22-alpine",
" WORKDIR /app",
" COPY package.json .",
"-RUN npm ci --omit=dev",
"+RUN npm install --omit=dev",
" COPY index.js .",
" CMD [\"node\", \"index.js\"]"
],
"scoring": {
"must_touch": [
"Dockerfile"
],
"must_contain": [
{
"path": "Dockerfile",
"text": "RUN npm install --omit=dev"
}
],
"must_not_contain": []
},
"split": "seed"
},
{
"id": "sbd-0003",
"title": "Go multi-stage build copies the wrong binary",
"summary": "The builder stage writes /out/server, but the runtime stage tries to copy and execute /out/api.",
"failure_type": "multistage_artifact_mismatch",
"ecosystem": "go",
"difficulty": "easy",
"tags": [
"dockerfile",
"go",
"multi-stage",
"copy"
],
"files": [
{
"path": "Dockerfile",
"content": [
"FROM golang:1.23-alpine AS build",
"WORKDIR /src",
"COPY go.mod ./",
"COPY main.go ./",
"RUN go build -o /out/server ./...",
"FROM alpine:3.20",
"COPY --from=build /out/api /usr/local/bin/api",
"CMD [\"api\"]"
]
},
{
"path": "go.mod",
"content": [
"module example.com/sabnock/sbd0003",
"",
"go 1.23"
]
},
{
"path": "main.go",
"content": [
"package main",
"",
"import \"fmt\"",
"",
"func main() {",
" fmt.Println(\"ok\")",
"}"
]
}
],
"failure_log": [
"failed to solve: failed to compute cache key: failed to calculate checksum of ref: \"/out/api\": not found"
],
"build": {
"command": "docker build -t sabnock/sbd-0003 ."
},
"verify": {
"commands": [
"docker build -t sabnock/sbd-0003 ."
]
},
"oracle_patch": [
"diff --git a/Dockerfile b/Dockerfile",
"--- a/Dockerfile",
"+++ b/Dockerfile",
"@@ -3,6 +3,6 @@",
" COPY go.mod ./",
" COPY main.go ./",
" RUN go build -o /out/server ./...",
" FROM alpine:3.20",
"-COPY --from=build /out/api /usr/local/bin/api",
"-CMD [\"api\"]",
"+COPY --from=build /out/server /usr/local/bin/server",
"+CMD [\"server\"]"
],
"scoring": {
"must_touch": [
"Dockerfile"
],
"must_contain": [
{
"path": "Dockerfile",
"text": "/out/server /usr/local/bin/server"
},
{
"path": "Dockerfile",
"text": "CMD [\"server\"]"
}
],
"must_not_contain": []
},
"split": "seed"
},
{
"id": "sbd-0004",
"title": "Compose API starts before Postgres is ready",
"summary": "depends_on only controls startup order. The API starts while Postgres is still initializing, so integration tests see connection refused.",
"failure_type": "compose_readiness",
"ecosystem": "compose",
"difficulty": "medium",
"tags": [
"compose",
"postgres",
"healthcheck",
"integration-test"
],
"files": [
{
"path": "docker-compose.yml",
"content": [
"services:",
" api:",
" build: .",
" environment:",
" DATABASE_URL: postgres://postgres:postgres@db:5432/postgres",
" depends_on:",
" - db",
" db:",
" image: postgres:16-alpine",
" environment:",
" POSTGRES_PASSWORD: postgres"
]
},
{
"path": "Dockerfile",
"content": [
"FROM python:3.12-slim",
"WORKDIR /app",
"COPY app.py .",
"CMD [\"python\", \"app.py\"]"
]
},
{
"path": "app.py",
"content": [
"import os",
"print(os.environ['DATABASE_URL'])"
]
}
],
"failure_log": [
"api-1 | psycopg.OperationalError: connection failed: Connection refused",
"db-1 | database system is ready to accept connections"
],
"build": {
"command": "docker compose up --build --abort-on-container-exit"
},
"verify": {
"commands": [
"docker compose config --quiet"
]
},
"oracle_patch": [
"diff --git a/docker-compose.yml b/docker-compose.yml",
"--- a/docker-compose.yml",
"+++ b/docker-compose.yml",
"@@ -1,11 +1,16 @@",
" services:",
" api:",
" build: .",
" environment:",
" DATABASE_URL: postgres://postgres:postgres@db:5432/postgres",
" depends_on:",
"- - db",
"+ db:",
"+ condition: service_healthy",
" db:",
" image: postgres:16-alpine",
" environment:",
" POSTGRES_PASSWORD: postgres",
"+ healthcheck:",
"+ test: [\"CMD-SHELL\", \"pg_isready -U postgres\"]",
"+ interval: 2s",
"+ timeout: 3s",
"+ retries: 20"
],
"scoring": {
"must_touch": [
"docker-compose.yml"
],
"must_contain": [
{
"path": "docker-compose.yml",
"text": "condition: service_healthy"
},
{
"path": "docker-compose.yml",
"text": "pg_isready -U postgres"
}
],
"must_not_contain": []
},
"split": "seed"
},
{
"id": "sbd-0005",
"title": ".dockerignore excludes the production dist directory",
"summary": "The image is supposed to serve an already-built static site, but .dockerignore removes dist from the build context.",
"failure_type": "dockerignore_artifact_excluded",
"ecosystem": "frontend",
"difficulty": "easy",
"tags": [
"dockerfile",
"dockerignore",
"nginx",
"static-site"
],
"files": [
{
"path": "Dockerfile",
"content": [
"FROM nginx:1.27-alpine",
"COPY dist/ /usr/share/nginx/html/"
]
},
{
"path": ".dockerignore",
"content": [
"node_modules",
"dist"
]
},
{
"path": "dist/index.html",
"content": [
"<!doctype html>",
"<html><body>ok</body></html>"
]
}
],
"failure_log": [
"failed to compute cache key: failed to calculate checksum of ref: \"/dist\": not found"
],
"build": {
"command": "docker build -t sabnock/sbd-0005 ."
},
"verify": {
"commands": [
"docker build -t sabnock/sbd-0005 ."
]
},
"oracle_patch": [
"diff --git a/.dockerignore b/.dockerignore",
"--- a/.dockerignore",
"+++ b/.dockerignore",
"@@ -1,2 +1 @@",
" node_modules",
"-dist"
],
"scoring": {
"must_touch": [
".dockerignore"
],
"must_contain": [],
"must_not_contain": [
{
"path": ".dockerignore",
"text": "dist"
}
]
},
"split": "seed"
},
{
"id": "sbd-0006",
"title": "Rust Alpine build misses OpenSSL native packages",
"summary": "The crate depends on openssl, but the Alpine builder does not install the native headers and pkg-config needed by openssl-sys.",
"failure_type": "native_dependency_missing",
"ecosystem": "rust",
"difficulty": "medium",
"tags": [
"dockerfile",
"rust",
"alpine",
"openssl",
"native-deps"
],
"files": [
{
"path": "Dockerfile",
"content": [
"FROM rust:1.79-alpine AS build",
"WORKDIR /src",
"COPY Cargo.toml .",
"RUN cargo fetch",
"COPY src ./src",
"RUN cargo build --release"
]
},
{
"path": "Cargo.toml",
"content": [
"[package]",
"name = \"sbd0006\"",
"version = \"0.1.0\"",
"edition = \"2021\"",
"",
"[dependencies]",
"openssl = \"0.10\""
]
},
{
"path": "src/main.rs",
"content": [
"fn main() {",
" println!(\"ok\");",
"}"
]
}
],
"failure_log": [
"error: failed to run custom build command for `openssl-sys`",
"Could not find directory of OpenSSL installation, and this `-sys` crate cannot proceed without this knowledge."
],
"build": {
"command": "docker build -t sabnock/sbd-0006 ."
},
"verify": {
"commands": [
"docker build -t sabnock/sbd-0006 ."
]
},
"oracle_patch": [
"diff --git a/Dockerfile b/Dockerfile",
"--- a/Dockerfile",
"+++ b/Dockerfile",
"@@ -1,6 +1,7 @@",
" FROM rust:1.79-alpine AS build",
" WORKDIR /src",
"+RUN apk add --no-cache musl-dev pkgconfig openssl-dev",
" COPY Cargo.toml .",
" RUN cargo fetch",
" COPY src ./src",
" RUN cargo build --release"
],
"scoring": {
"must_touch": [
"Dockerfile"
],
"must_contain": [
{
"path": "Dockerfile",
"text": "apk add --no-cache musl-dev pkgconfig openssl-dev"
}
],
"must_not_contain": []
},
"split": "seed"
},
{
"id": "sbd-0007",
"title": "Python src layout is not importable in the container",
"summary": "The app lives under src/app, but the container runs python -m app without adding /app/src to PYTHONPATH.",
"failure_type": "python_src_layout_import",
"ecosystem": "python",
"difficulty": "easy",
"tags": [
"dockerfile",
"python",
"src-layout",
"runtime"
],
"files": [
{
"path": "Dockerfile",
"content": [
"FROM python:3.12-slim",
"WORKDIR /app",
"COPY requirements.txt .",
"RUN pip install --no-cache-dir -r requirements.txt",
"COPY src ./src",
"CMD [\"python\", \"-m\", \"app\"]"
]
},
{
"path": "requirements.txt",
"content": []
},
{
"path": "src/app/__main__.py",
"content": [
"print(\"ok\")"
]
}
],
"failure_log": [
"/usr/local/bin/python: No module named app"
],
"build": {
"command": "docker build -t sabnock/sbd-0007 ."
},
"verify": {
"commands": [
"docker build -t sabnock/sbd-0007 .",
"docker run --rm sabnock/sbd-0007"
]
},
"oracle_patch": [
"diff --git a/Dockerfile b/Dockerfile",
"--- a/Dockerfile",
"+++ b/Dockerfile",
"@@ -3,4 +3,5 @@",
" COPY requirements.txt .",
" RUN pip install --no-cache-dir -r requirements.txt",
" COPY src ./src",
"+ENV PYTHONPATH=/app/src",
" CMD [\"python\", \"-m\", \"app\"]"
],
"scoring": {
"must_touch": [
"Dockerfile"
],
"must_contain": [
{
"path": "Dockerfile",
"text": "ENV PYTHONPATH=/app/src"
}
],
"must_not_contain": []
},
"split": "seed"
},
{
"id": "sbd-0008",
"title": "Poetry install tries to install the app before source files exist",
"summary": "The Dockerfile copies only pyproject.toml, then runs poetry install. Poetry attempts to install the root project and fails because package metadata/source files are not present yet.",
"failure_type": "poetry_root_install_order",
"ecosystem": "python",
"difficulty": "medium",
"tags": [
"dockerfile",
"python",
"poetry",
"dependency-install"
],
"files": [
{
"path": "Dockerfile",
"content": [
"FROM python:3.12-slim",
"WORKDIR /app",
"RUN pip install --no-cache-dir poetry==1.8.3",
"COPY pyproject.toml ./",
"RUN poetry install --only main",
"COPY service ./service",
"CMD [\"poetry\", \"run\", \"python\", \"-m\", \"service\"]"
]
},
{
"path": "pyproject.toml",
"content": [
"[tool.poetry]",
"name = \"sbd0008\"",
"version = \"0.1.0\"",
"description = \"synthetic task\"",
"authors = [\"Sabnock <bench@example.com>\"]",
"packages = [{ include = \"service\" }]",
"",
"[tool.poetry.dependencies]",
"python = \"^3.12\"",
"",
"[build-system]",
"requires = [\"poetry-core\"]",
"build-backend = \"poetry.core.masonry.api\""
]
},
{
"path": "service/__main__.py",
"content": [
"print(\"ok\")"
]
}
],
"failure_log": [
"Installing the current project: sbd0008 (0.1.0)",
"Error: The current project could not be installed: No file/folder found for package service"
],
"build": {
"command": "docker build -t sabnock/sbd-0008 ."
},
"verify": {
"commands": [
"docker build -t sabnock/sbd-0008 ."
]
},
"oracle_patch": [
"diff --git a/Dockerfile b/Dockerfile",
"--- a/Dockerfile",
"+++ b/Dockerfile",
"@@ -2,6 +2,6 @@",
" WORKDIR /app",
" RUN pip install --no-cache-dir poetry==1.8.3",
" COPY pyproject.toml ./",
"-RUN poetry install --only main",
"+RUN poetry install --only main --no-root",
" COPY service ./service",
" CMD [\"poetry\", \"run\", \"python\", \"-m\", \"service\"]"
],
"scoring": {
"must_touch": [
"Dockerfile"
],
"must_contain": [
{
"path": "Dockerfile",
"text": "poetry install --only main --no-root"
}
],
"must_not_contain": []
},
"split": "seed"
},
{
"id": "sbd-0009",
"title": "Compose bind mount hides node_modules from the image",
"summary": "The image installs dependencies, but docker compose bind-mounts the host project over /app. On a clean host without node_modules, runtime imports fail.",
"failure_type": "compose_bind_mount_masks_dependencies",
"ecosystem": "node",
"difficulty": "medium",
"tags": [
"compose",
"node",
"bind-mount",
"node_modules"
],
"files": [
{
"path": "docker-compose.yml",
"content": [
"services:",
" web:",
" build: .",
" command: npm start",
" volumes:",
" - .:/app"
]
},
{
"path": "Dockerfile",
"content": [
"FROM node:22-alpine",
"WORKDIR /app",
"COPY package.json .",
"RUN npm install",
"COPY index.js .",
"CMD [\"npm\", \"start\"]"
]
},
{
"path": "package.json",
"content": [
"{\"scripts\":{\"start\":\"node index.js\"},\"dependencies\":{\"express\":\"4.19.2\"}}"
]
},
{
"path": "index.js",
"content": [
"require('express')().listen(3000, '0.0.0.0');"
]
}
],
"failure_log": [
"web-1 | Error: Cannot find module 'express'",
"web-1 | Require stack: /app/index.js"
],
"build": {
"command": "docker compose up --build"
},
"verify": {
"commands": [
"docker compose config --quiet"
]
},
"oracle_patch": [
"diff --git a/docker-compose.yml b/docker-compose.yml",
"--- a/docker-compose.yml",
"+++ b/docker-compose.yml",
"@@ -3,4 +3,5 @@",
" build: .",
" command: npm start",
" volumes:",
" - .:/app",
"+ - /app/node_modules"
],
"scoring": {
"must_touch": [
"docker-compose.yml"
],
"must_contain": [
{
"path": "docker-compose.yml",
"text": "/app/node_modules"
}
],
"must_not_contain": []
},
"split": "seed"
},
{
"id": "sbd-0010",
"title": "Dockerfile leaks an npm token through ARG and image layers",
"summary": "The build uses ARG NPM_TOKEN and writes it to .npmrc in a RUN layer. A secure fix should use BuildKit secrets and remove the temporary .npmrc.",
"failure_type": "build_secret_leak",
"ecosystem": "node",
"difficulty": "hard",
"tags": [
"dockerfile",
"node",
"buildkit",
"secrets",
"security"
],
"files": [
{
"path": "Dockerfile",
"content": [
"FROM node:22-alpine",
"WORKDIR /app",
"ARG NPM_TOKEN",
"COPY package*.json ./",
"RUN echo \"//registry.npmjs.org/:_authToken=${NPM_TOKEN}\" > .npmrc && npm ci --omit=dev",
"COPY index.js .",
"CMD [\"node\", \"index.js\"]"
]
},
{
"path": "package.json",
"content": [
"{\"scripts\":{\"start\":\"node index.js\"},\"dependencies\":{\"left-pad\":\"1.3.0\"}}"
]
},
{
"path": "package-lock.json",
"content": [
"{\"name\":\"sbd0010\",\"lockfileVersion\":3,\"packages\":{}}"
]
},
{
"path": "index.js",
"content": [
"console.log('ok')"
]
}
],
"failure_log": [
"hadolint: SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data",
"security-scan: token material may persist in image layer history"
],
"build": {
"command": "DOCKER_BUILDKIT=1 docker build --secret id=npm_token,src=.npm-token -t sabnock/sbd-0010 ."
},
"verify": {
"commands": [
"docker buildx build --check ."
]
},
"oracle_patch": [
"diff --git a/Dockerfile b/Dockerfile",
"--- a/Dockerfile",
"+++ b/Dockerfile",
"@@ -1,7 +1,7 @@",
"+# syntax=docker/dockerfile:1.7",
" FROM node:22-alpine",
" WORKDIR /app",
"-ARG NPM_TOKEN",
" COPY package*.json ./",
"-RUN echo \"//registry.npmjs.org/:_authToken=${NPM_TOKEN}\" > .npmrc && npm ci --omit=dev",
"+RUN --mount=type=secret,id=npm_token sh -c 'echo \"//registry.npmjs.org/:_authToken=$(cat /run/secrets/npm_token)\" > .npmrc && npm ci --omit=dev && rm .npmrc'",
" COPY index.js .",
" CMD [\"node\", \"index.js\"]"
],
"scoring": {
"must_touch": [
"Dockerfile"
],
"must_contain": [
{
"path": "Dockerfile",
"text": "# syntax=docker/dockerfile:1.7"
},
{
"path": "Dockerfile",
"text": "--mount=type=secret,id=npm_token"
},
{
"path": "Dockerfile",
"text": "rm .npmrc"
}
],
"must_not_contain": [
{
"path": "Dockerfile",
"text": "ARG NPM_TOKEN"
},
{
"path": "Dockerfile",
"text": "${NPM_TOKEN}"
}
]
},
"split": "seed"
},
{
"id": "sbd-0011",
"title": "Ubuntu image installs apt packages without apt-get update",
"summary": "The package install runs against an image with no fresh package lists, causing apt to fail in a clean build.",
"failure_type": "apt_update_missing",
"ecosystem": "linux",
"difficulty": "easy",
"tags": [
"dockerfile",
"apt",
"ubuntu",
"package-install"
],
"files": [
{
"path": "Dockerfile",
"content": [
"FROM ubuntu:24.04",
"RUN apt-get install -y curl ca-certificates",
"CMD [\"curl\", \"--version\"]"
]
}
],
"failure_log": [
"Reading package lists...",
"E: Unable to locate package curl",
"E: Unable to locate package ca-certificates"
],
"build": {
"command": "docker build -t sabnock/sbd-0011 ."
},
"verify": {
"commands": [
"docker build -t sabnock/sbd-0011 ."
]
},
"oracle_patch": [
"diff --git a/Dockerfile b/Dockerfile",
"--- a/Dockerfile",
"+++ b/Dockerfile",
"@@ -1,3 +1,3 @@",
" FROM ubuntu:24.04",
"-RUN apt-get install -y curl ca-certificates",
"+RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates && rm -rf /var/lib/apt/lists/*",
" CMD [\"curl\", \"--version\"]"
],
"scoring": {
"must_touch": [
"Dockerfile"
],
"must_contain": [
{
"path": "Dockerfile",
"text": "apt-get update && apt-get install"
},
{
"path": "Dockerfile",
"text": "rm -rf /var/lib/apt/lists/*"
}
],
"must_not_contain": []
},
"split": "seed"
},
{
"id": "sbd-0012",
"title": "FastAPI container binds to localhost",
"summary": "The app starts inside the container, but Uvicorn binds to 127.0.0.1. Published ports on the host cannot reach it.",
"failure_type": "container_network_binding",
"ecosystem": "python",
"difficulty": "easy",
"tags": [
"dockerfile",
"fastapi",
"uvicorn",
"runtime",
"network"
],
"files": [
{
"path": "Dockerfile",
"content": [
"FROM python:3.12-slim",
"WORKDIR /app",
"COPY requirements.txt .",
"RUN pip install --no-cache-dir -r requirements.txt",
"COPY main.py .",
"EXPOSE 8000",
"CMD [\"uvicorn\", \"main:app\", \"--host\", \"127.0.0.1\", \"--port\", \"8000\"]"
]
},
{
"path": "requirements.txt",
"content": [
"fastapi==0.111.0",
"uvicorn[standard]==0.30.1"
]
},
{
"path": "main.py",
"content": [
"from fastapi import FastAPI",
"",
"app = FastAPI()",
"",
"@app.get('/health')",
"def health():",
" return {'status': 'ok'}"
]
}
],
"failure_log": [
"curl: (56) Recv failure: Connection reset by peer",
"container log: Uvicorn running on http://127.0.0.1:8000"
],
"build": {
"command": "docker build -t sabnock/sbd-0012 ."
},
"verify": {
"commands": [
"docker build -t sabnock/sbd-0012 ."
]
},
"oracle_patch": [
"diff --git a/Dockerfile b/Dockerfile",
"--- a/Dockerfile",
"+++ b/Dockerfile",
"@@ -4,4 +4,4 @@",
" RUN pip install --no-cache-dir -r requirements.txt",
" COPY main.py .",
" EXPOSE 8000",
"-CMD [\"uvicorn\", \"main:app\", \"--host\", \"127.0.0.1\", \"--port\", \"8000\"]",
"+CMD [\"uvicorn\", \"main:app\", \"--host\", \"0.0.0.0\", \"--port\", \"8000\"]"
],
"scoring": {
"must_touch": [
"Dockerfile"
],
"must_contain": [
{
"path": "Dockerfile",
"text": "0.0.0.0"
}
],
"must_not_contain": []
},
"split": "seed"
}
]
|