mirror of
https://github.com/containers/podman.git
synced 2025-07-02 00:30:00 +08:00
Support --http-proxy for remote builds
* Fix misspelled parameter * add http-proxy support for builds http_proxy must be set in the podman.service unit file, for example Environment=http_proxy=<value> Signed-off-by: Jhon Honce <jhonce@redhat.com>
This commit is contained in:
@ -70,37 +70,38 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
query := struct {
|
query := struct {
|
||||||
Dockerfile string `schema:"dockerfile"`
|
BuildArgs string `schema:"buildargs"`
|
||||||
Tag []string `schema:"t"`
|
|
||||||
ExtraHosts string `schema:"extrahosts"`
|
|
||||||
Remote string `schema:"remote"`
|
|
||||||
Quiet bool `schema:"q"`
|
|
||||||
NoCache bool `schema:"nocache"`
|
|
||||||
CacheFrom string `schema:"cachefrom"`
|
CacheFrom string `schema:"cachefrom"`
|
||||||
Pull bool `schema:"pull"`
|
|
||||||
Rm bool `schema:"rm"`
|
|
||||||
ForceRm bool `schema:"forcerm"`
|
|
||||||
Memory int64 `schema:"memory"`
|
|
||||||
MemSwap int64 `schema:"memswap"`
|
|
||||||
CpuShares uint64 `schema:"cpushares"` // nolint
|
|
||||||
CpuSetCpus string `schema:"cpusetcpus"` // nolint
|
|
||||||
CpuPeriod uint64 `schema:"cpuperiod"` // nolint
|
CpuPeriod uint64 `schema:"cpuperiod"` // nolint
|
||||||
CpuQuota int64 `schema:"cpuquota"` // nolint
|
CpuQuota int64 `schema:"cpuquota"` // nolint
|
||||||
BuildArgs string `schema:"buildargs"`
|
CpuSetCpus string `schema:"cpusetcpus"` // nolint
|
||||||
|
CpuShares uint64 `schema:"cpushares"` // nolint
|
||||||
|
Dockerfile string `schema:"dockerfile"`
|
||||||
|
ExtraHosts string `schema:"extrahosts"`
|
||||||
|
ForceRm bool `schema:"forcerm"`
|
||||||
|
HTTPProxy bool `schema:"httpproxy"`
|
||||||
|
Labels string `schema:"labels"`
|
||||||
|
MemSwap int64 `schema:"memswap"`
|
||||||
|
Memory int64 `schema:"memory"`
|
||||||
|
NetworkMode string `schema:"networkmode"`
|
||||||
|
NoCache bool `schema:"nocache"`
|
||||||
|
Outputs string `schema:"outputs"`
|
||||||
|
Platform string `schema:"platform"`
|
||||||
|
Pull bool `schema:"pull"`
|
||||||
|
Quiet bool `schema:"q"`
|
||||||
|
Registry string `schema:"registry"`
|
||||||
|
Remote string `schema:"remote"`
|
||||||
|
Rm bool `schema:"rm"`
|
||||||
ShmSize int `schema:"shmsize"`
|
ShmSize int `schema:"shmsize"`
|
||||||
Squash bool `schema:"squash"`
|
Squash bool `schema:"squash"`
|
||||||
Labels string `schema:"labels"`
|
Tag []string `schema:"t"`
|
||||||
NetworkMode string `schema:"networkmode"`
|
|
||||||
Platform string `schema:"platform"`
|
|
||||||
Target string `schema:"target"`
|
Target string `schema:"target"`
|
||||||
Outputs string `schema:"outputs"`
|
|
||||||
Registry string `schema:"registry"`
|
|
||||||
}{
|
}{
|
||||||
Dockerfile: "Dockerfile",
|
Dockerfile: "Dockerfile",
|
||||||
Tag: []string{},
|
Registry: "docker.io",
|
||||||
Rm: true,
|
Rm: true,
|
||||||
ShmSize: 64 * 1024 * 1024,
|
ShmSize: 64 * 1024 * 1024,
|
||||||
Registry: "docker.io",
|
Tag: []string{},
|
||||||
}
|
}
|
||||||
|
|
||||||
decoder := r.Context().Value("decoder").(*schema.Decoder)
|
decoder := r.Context().Value("decoder").(*schema.Decoder)
|
||||||
@ -184,6 +185,7 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
|
|||||||
CPUQuota: query.CpuQuota,
|
CPUQuota: query.CpuQuota,
|
||||||
CPUShares: query.CpuShares,
|
CPUShares: query.CpuShares,
|
||||||
CPUSetCPUs: query.CpuSetCpus,
|
CPUSetCPUs: query.CpuSetCpus,
|
||||||
|
HTTPProxy: query.HTTPProxy,
|
||||||
Memory: query.Memory,
|
Memory: query.Memory,
|
||||||
MemorySwap: query.MemSwap,
|
MemorySwap: query.MemSwap,
|
||||||
ShmSize: strconv.Itoa(query.ShmSize),
|
ShmSize: strconv.Itoa(query.ShmSize),
|
||||||
|
@ -1423,6 +1423,13 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
|
|||||||
// description: |
|
// description: |
|
||||||
// output configuration TBD
|
// output configuration TBD
|
||||||
// (As of version 1.xx)
|
// (As of version 1.xx)
|
||||||
|
// - in: query
|
||||||
|
// name: httpproxy
|
||||||
|
// type: boolean
|
||||||
|
// default:
|
||||||
|
// description: |
|
||||||
|
// Inject http proxy environment variables into container
|
||||||
|
// (As of version 2.0.0)
|
||||||
// produces:
|
// produces:
|
||||||
// - application/json
|
// - application/json
|
||||||
// responses:
|
// responses:
|
||||||
|
@ -60,7 +60,7 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
|
|||||||
params.Set("cpushares", strconv.Itoa(int(cpuShares)))
|
params.Set("cpushares", strconv.Itoa(int(cpuShares)))
|
||||||
}
|
}
|
||||||
if cpuSetCpus := options.CommonBuildOpts.CPUSetCPUs; len(cpuSetCpus) > 0 {
|
if cpuSetCpus := options.CommonBuildOpts.CPUSetCPUs; len(cpuSetCpus) > 0 {
|
||||||
params.Set("cpusetcpues", cpuSetCpus)
|
params.Set("cpusetcpus", cpuSetCpus)
|
||||||
}
|
}
|
||||||
if cpuPeriod := options.CommonBuildOpts.CPUPeriod; cpuPeriod > 0 {
|
if cpuPeriod := options.CommonBuildOpts.CPUPeriod; cpuPeriod > 0 {
|
||||||
params.Set("cpuperiod", strconv.Itoa(int(cpuPeriod)))
|
params.Set("cpuperiod", strconv.Itoa(int(cpuPeriod)))
|
||||||
@ -92,6 +92,9 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
|
|||||||
}
|
}
|
||||||
params.Set("labels", l)
|
params.Set("labels", l)
|
||||||
}
|
}
|
||||||
|
if options.CommonBuildOpts.HTTPProxy {
|
||||||
|
params.Set("httpproxy", "1")
|
||||||
|
}
|
||||||
|
|
||||||
stdout := io.Writer(os.Stdout)
|
stdout := io.Writer(os.Stdout)
|
||||||
if options.Out != nil {
|
if options.Out != nil {
|
||||||
|
Reference in New Issue
Block a user