mirror of
https://github.com/psviderski/uncloud.git
synced 2026-10-06 13:18:58 +00:00
feat(compose): handle image pull policy
This commit is contained in:
1 parent
641b11a92d
commit
1911e03c82
1 file changed
+13
@@ -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
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user