Skip to content

Commit

Permalink
Clean-up intermediate images from Docker build process
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgospodinow committed Feb 11, 2024
1 parent 8e11a62 commit d331335
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def test_healthy_package(client, image):
logs = container.logs(stdout=True, stderr=True).decode("utf-8")
print(exit_code, "\n", logs)

container.stop()
container.remove()

assert exit_code["StatusCode"] == 0
Expand All @@ -38,6 +39,7 @@ def test_unhealthy_package(client, image):
logs = container.logs(stdout=True, stderr=True).decode("utf-8")
print(exit_code, "\n", logs)

container.stop()
container.remove()

assert exit_code["StatusCode"] != 0
Expand All @@ -46,13 +48,15 @@ def test_unhealthy_package(client, image):

def main():
client = docker.from_env()
image, _ = client.images.build(path="../", tag="nilaway-action-test-image")
image, _ = client.images.build(path="../", tag="nilaway-action-test-image", rm=True)

test_healthy_package(client, image)
test_unhealthy_package(client, image)

print("All tests passed!")

client.images.remove(image.id)


if __name__ == "__main__":
main()

0 comments on commit d331335

Please sign in to comment.