summaryrefslogtreecommitdiff
path: root/pkg/bindings/images/build.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/bindings/images/build.go')
-rw-r--r--pkg/bindings/images/build.go21
1 files changed, 14 insertions, 7 deletions
diff --git a/pkg/bindings/images/build.go b/pkg/bindings/images/build.go
index ef875c9eb..f8552cddb 100644
--- a/pkg/bindings/images/build.go
+++ b/pkg/bindings/images/build.go
@@ -9,7 +9,6 @@ import (
"fmt"
"io"
"io/fs"
- "io/ioutil"
"net/http"
"net/url"
"os"
@@ -234,6 +233,14 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
if options.CacheFrom != nil {
params.Set("cachefrom", options.CacheFrom.String())
}
+
+ switch options.SkipUnusedStages {
+ case types.OptionalBoolTrue:
+ params.Set("skipunusedstages", "1")
+ case types.OptionalBoolFalse:
+ params.Set("skipunusedstages", "0")
+ }
+
if options.CacheTo != nil {
params.Set("cacheto", options.CacheTo.String())
}
@@ -395,11 +402,11 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
dontexcludes := []string{"!Dockerfile", "!Containerfile", "!.dockerignore", "!.containerignore"}
for _, c := range containerFiles {
if c == "/dev/stdin" {
- content, err := ioutil.ReadAll(os.Stdin)
+ content, err := io.ReadAll(os.Stdin)
if err != nil {
return nil, err
}
- tmpFile, err := ioutil.TempFile("", "build")
+ tmpFile, err := os.CreateTemp("", "build")
if err != nil {
return nil, err
}
@@ -465,7 +472,7 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
if arr[0] == "src" {
// read specified secret into a tmp file
// move tmp file to tar and change secret source to relative tmp file
- tmpSecretFile, err := ioutil.TempFile(options.ContextDirectory, "podman-build-secret")
+ tmpSecretFile, err := os.CreateTemp(options.ContextDirectory, "podman-build-secret")
if err != nil {
return nil, err
}
@@ -531,7 +538,7 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
if logrus.IsLevelEnabled(logrus.DebugLevel) {
if v, found := os.LookupEnv("PODMAN_RETAIN_BUILD_ARTIFACT"); found {
if keep, _ := strconv.ParseBool(v); keep {
- t, _ := ioutil.TempFile("", "build_*_client")
+ t, _ := os.CreateTemp("", "build_*_client")
defer t.Close()
body = io.TeeReader(response.Body, t)
}
@@ -737,10 +744,10 @@ func nTar(excludes []string, sources ...string) (io.ReadCloser, error) {
}
func parseDockerignore(root string) ([]string, error) {
- ignore, err := ioutil.ReadFile(filepath.Join(root, ".containerignore"))
+ ignore, err := os.ReadFile(filepath.Join(root, ".containerignore"))
if err != nil {
var dockerIgnoreErr error
- ignore, dockerIgnoreErr = ioutil.ReadFile(filepath.Join(root, ".dockerignore"))
+ ignore, dockerIgnoreErr = os.ReadFile(filepath.Join(root, ".dockerignore"))
if dockerIgnoreErr != nil && !os.IsNotExist(dockerIgnoreErr) {
return nil, err
}