No rebuild on compose up if image already exists by default, added first use of compose pull_policy and compose up --build to allow to force rebuild.

Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
This commit is contained in:
Guillaume Tardif 2020-12-10 10:22:18 +01:00
parent bb7b47be39
commit cf378834e5
6 changed files with 41 additions and 20 deletions

View file

@ -123,6 +123,9 @@ func TestLocalComposeBuild(t *testing.T) {
c.RunDockerOrExitError("rmi", "custom-nginx")
res := c.RunDockerCmd("compose", "up", "-d", "--workdir", "fixtures/build-test")
t.Cleanup(func() {
c.RunDockerCmd("compose", "down", "--workdir", "fixtures/build-test")
})
res.Assert(t, icmd.Expected{Out: "COPY static /usr/share/nginx/html"})
@ -133,6 +136,12 @@ func TestLocalComposeBuild(t *testing.T) {
c.RunDockerCmd("image", "inspect", "custom-nginx")
})
t.Run("no rebuild when up again", func(t *testing.T) {
res := c.RunDockerCmd("compose", "up", "-d", "--workdir", "fixtures/build-test")
assert.Assert(t, !strings.Contains(res.Stdout(), "COPY static /usr/share/nginx/html"), res.Stdout())
})
t.Run("cleanup build project", func(t *testing.T) {
c.RunDockerCmd("compose", "down", "--workdir", "fixtures/build-test")
c.RunDockerCmd("rmi", "build-test_nginx")