2021-02-19 09:09:53 +01:00
|
|
|
package test
|
|
|
|
|
|
|
|
import "dagger.io/dagger"
|
|
|
|
|
|
|
|
// Set to `--input-dir=./tests/dockerbuild/testdata`
|
|
|
|
TestData: dagger.#Dir
|
|
|
|
|
2021-02-13 00:22:41 +01:00
|
|
|
TestInlinedDockerfile: #compute: [
|
2021-02-19 09:09:53 +01:00
|
|
|
dagger.#DockerBuild & {
|
|
|
|
dockerfile: """
|
|
|
|
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
|
|
|
RUN echo hello world
|
|
|
|
"""
|
|
|
|
},
|
|
|
|
]
|
|
|
|
|
2021-02-13 00:22:41 +01:00
|
|
|
TestOpChaining: #compute: [
|
2021-02-19 09:09:53 +01:00
|
|
|
dagger.#DockerBuild & {
|
|
|
|
dockerfile: """
|
|
|
|
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
|
|
|
RUN echo foobar > /output
|
|
|
|
"""
|
|
|
|
},
|
|
|
|
dagger.#Exec & {
|
|
|
|
args: ["sh", "-c", "test $(cat /output) = foobar"]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2021-02-13 00:22:41 +01:00
|
|
|
TestBuildContext: #compute: [
|
2021-02-19 09:09:53 +01:00
|
|
|
dagger.#DockerBuild & {
|
|
|
|
context: TestData
|
|
|
|
},
|
|
|
|
dagger.#Exec & {
|
|
|
|
args: ["sh", "-c", "test $(cat /dir/foo) = foobar"]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2021-02-13 00:22:41 +01:00
|
|
|
TestBuildContextAndDockerfile: #compute: [
|
2021-02-19 09:09:53 +01:00
|
|
|
dagger.#DockerBuild & {
|
|
|
|
context: TestData
|
|
|
|
dockerfile: """
|
|
|
|
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
|
|
|
COPY foo /override
|
|
|
|
"""
|
|
|
|
},
|
|
|
|
dagger.#Exec & {
|
|
|
|
args: ["sh", "-c", "test $(cat /override) = foobar"]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2021-02-13 00:22:41 +01:00
|
|
|
TestDockerfilePath: #compute: [
|
2021-02-19 09:09:53 +01:00
|
|
|
dagger.#DockerBuild & {
|
|
|
|
context: TestData
|
|
|
|
dockerfilePath: "./dockerfilepath/Dockerfile.custom"
|
|
|
|
},
|
|
|
|
dagger.#Exec & {
|
|
|
|
args: ["sh", "-c", "test $(cat /test) = dockerfilePath"]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2021-02-13 00:22:41 +01:00
|
|
|
TestBuildArgs: #compute: [
|
2021-02-19 09:09:53 +01:00
|
|
|
dagger.#DockerBuild & {
|
|
|
|
dockerfile: """
|
|
|
|
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
|
|
|
ARG TEST=foo
|
|
|
|
RUN test "${TEST}" = "bar"
|
|
|
|
"""
|
|
|
|
buildArg: TEST: "bar"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
// FIXME: this doesn't test anything beside not crashing
|
2021-02-13 00:22:41 +01:00
|
|
|
TestBuildLabels: #compute: [
|
2021-02-19 09:09:53 +01:00
|
|
|
dagger.#DockerBuild & {
|
|
|
|
dockerfile: """
|
|
|
|
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
|
|
|
"""
|
|
|
|
label: FOO: "bar"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
// FIXME: this doesn't test anything beside not crashing
|
2021-02-13 00:22:41 +01:00
|
|
|
TestBuildPlatform: #compute: [
|
2021-02-19 09:09:53 +01:00
|
|
|
dagger.#DockerBuild & {
|
|
|
|
dockerfile: """
|
|
|
|
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
|
|
|
"""
|
|
|
|
platforms: ["linux/amd64"]
|
|
|
|
}
|
|
|
|
]
|