cirocosta / estaleiro

building container images with bill of materials
Apache License 2.0
2 stars 0 forks source link

frontend/config: use of globs #14

Open cirocosta opened 5 years ago

cirocosta commented 5 years ago
# syntax=cirocosta/estaleiro

image "concourse/s3-resource" {
  base_image {
    name = "ubuntu"
  }

  file "/opt/resource/check" {
    from_step "build" {
      path = "/opt/resource/check"
    }

  file "/opt/resource/in" {
    from_step "build" {
      path = "/opt/resource/in"
    }

  file "/opt/resource/out" {
    from_step "build" {
      path = "/opt/resource/out"
    }
  }
}

step "build" {
  dockerfile = "./s3-resource/dockerfiles/ubuntu/Dockerfile"
  context    = "./s3-resource"
  target     = "builder"

  source_file "/opt/resource/check" {
    vcs "git" {
      repository = "https://github.com/concourse/s3-resource"
      ref        = "master"
    }
  }

  source_file "/opt/resource/in" {
    vcs "git" {
      repository = "https://github.com/concourse/s3-resource"
      ref        = "master"
    }
  }

  source_file "/opt/resource/out" {
    vcs "git" {
      repository = "https://github.com/concourse/s3-resource"
      ref        = "master"
    }
  }
}

that whole repetition could just be:

# syntax=cirocosta/estaleiro

image "concourse/s3-resource" {
  base_image {
    name = "ubuntu"
  }

  file "/opt/resource/*" {
    from_step "build" {
      path = "/opt/resource/*"
    }
  }
}

step "build" {
  dockerfile = "./s3-resource/dockerfiles/ubuntu/Dockerfile"
  context    = "./s3-resource"
  target     = "builder"

  source_file "/opt/resource/*" {
    vcs "git" {
      repository = "https://github.com/concourse/s3-resource"
      ref        = "master"
    }
  }
}
cirocosta commented 5 years ago

As a way of tackling this, I think we can start with the globing in the steps firts (source_file), and then tackle the "in-image" later

cirocosta commented 5 years ago

did it for source_file 👍