diff --git a/stdlib/.dagger/env/docker-run-ports/.gitignore b/stdlib/.dagger/env/docker-run-ports/.gitignore new file mode 100644 index 00000000..01ec19b0 --- /dev/null +++ b/stdlib/.dagger/env/docker-run-ports/.gitignore @@ -0,0 +1,2 @@ +# dagger state +state/** diff --git a/stdlib/.dagger/env/docker-run-ports/values.yaml b/stdlib/.dagger/env/docker-run-ports/values.yaml new file mode 100644 index 00000000..ff47e285 --- /dev/null +++ b/stdlib/.dagger/env/docker-run-ports/values.yaml @@ -0,0 +1,23 @@ +plan: + package: ./docker/tests/run-ports +name: docker-run-ports +sops: + kms: [] + gcp_kms: [] + azure_kv: [] + hc_vault: [] + age: + - recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk + enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBpbHY3ZzZjWWdRcVd5UUdT + eFI4UmhTUkd6a0lscDZ3SzVFT2NiSzFRUHhFCnRsRXorSFhjano1WTcrYjlGZElm + S2o1V005SlpSbHBmbjJNZ1I3VTRXVGMKLS0tIEdlMThjcmNGK3VJdXV4anNud21x + TS80V3BnN3BaeDFTRjNBRTAwbWRKcWcK1rH2zWxTQsbSgOs9Ys89ZCP7kVOm1wFe + Kv849q+QOvIy9JPYkGgV16Yr3ijFF7z/h0PCicZRI76WYV/3JnbYmg== + -----END AGE ENCRYPTED FILE----- + lastmodified: "2021-09-28T15:06:47Z" + mac: ENC[AES256_GCM,data:WF2X4RCio9x459Fv4XK/P933cS9uac3kHA2+kfaft++ndxbHOY0zmOhUvNMmzLtJNTXL7oBADWIIqIiFbaaC0pC+xGq1th+woR3LvAVQi5J0rlDTcdMDPT03KOPdOmsXFDow5jzyn8vPsC59VCys0ZmEnmnHIGufnFy2qKVV0bM=,iv:GUrSk66zhDqxx+rVM9zMDfmcaDBSOOMIeCSViS2cuLU=,tag:rgCoWe//hn8xmeRmbc5ybQ==,type:str] + pgp: [] + encrypted_suffix: secret + version: 3.7.1 diff --git a/stdlib/docker/tests/run-ports/ports.cue b/stdlib/docker/tests/run-ports/ports.cue new file mode 100644 index 00000000..95a395c0 --- /dev/null +++ b/stdlib/docker/tests/run-ports/ports.cue @@ -0,0 +1,17 @@ +package docker + +import ( + "alpha.dagger.io/dagger" + "alpha.dagger.io/random" +) + +suffix: random.#String & { + seed: "" +} + +run: #Run & { + name: "daggerci-test-ports-\(suffix.out)" + ref: "nginx" + socket: dagger.#Stream & {unix: "/var/run/docker.sock"} + ports: ["8080:80"] +} diff --git a/stdlib/universe.bats b/stdlib/universe.bats index 2c820919..6f959f9b 100644 --- a/stdlib/universe.bats +++ b/stdlib/universe.bats @@ -79,6 +79,15 @@ setup() { dagger -e docker-run-local up } +@test "docker run: ports" { + dagger -e docker-run-ports up + CONTAINER=$(docker container ls -q --filter "name=daggerci-test-ports-*") + until docker inspect --format "{{json .State.Status }}" $CONTAINER | grep -m 1 "running"; do sleep 1 ; done + run curl -f -LI http://localhost:8080 + assert_output --partial '200 OK' + docker stop $CONTAINER && docker rm $CONTAINER +} + @test "docker build" { dagger -e docker-build up }