feat(compose): handle image pull policy

This commit is contained in:
Pavel Sviderski
2025-03-27 15:15:57 +10:00
parent 641b11a92d
commit 1911e03c82
+13
View File
@@ -7,11 +7,24 @@ import (
)
func ServiceSpecFromCompose(name string, service types.ServiceConfig) (api.ServiceSpec, error) {
pullPolicy := ""
switch service.PullPolicy {
case types.PullPolicyAlways:
pullPolicy = api.PullPolicyAlways
case "", types.PullPolicyMissing, types.PullPolicyIfNotPresent:
pullPolicy = api.PullPolicyMissing
case types.PullPolicyNever:
pullPolicy = api.PullPolicyNever
default:
return api.ServiceSpec{}, fmt.Errorf("unsupported pull policy: '%s'", service.PullPolicy)
}
spec := api.ServiceSpec{
Container: api.ContainerSpec{
Command: service.Command,
Image: service.Image,
Init: service.Init,
PullPolicy: pullPolicy,
// TODO: env
// TODO: volumes
},