mirror of
https://github.com/openfaas/faas.git
synced 2025-06-18 12:06:37 +00:00
Format and add multi-stage Dockerfile
This commit is contained in:
@ -18,8 +18,8 @@ EXPOSE 8080
|
|||||||
ENV http_proxy ""
|
ENV http_proxy ""
|
||||||
ENV https_proxy ""
|
ENV https_proxy ""
|
||||||
|
|
||||||
COPY --from 0 gateway .
|
COPY --from=0 /go/src/github.com/alexellis/faas/gateway/gateway .
|
||||||
|
|
||||||
COPY --from 0 assets assets
|
COPY assets assets
|
||||||
|
|
||||||
CMD ["./gateway"]
|
CMD ["./gateway"]
|
@ -174,11 +174,8 @@ func makeSpec(request *requests.CreateFunctionRequest) swarm.ServiceSpec {
|
|||||||
max := uint64(1)
|
max := uint64(1)
|
||||||
|
|
||||||
nets := []swarm.NetworkAttachmentConfig{
|
nets := []swarm.NetworkAttachmentConfig{
|
||||||
swarm.NetworkAttachmentConfig{Target: request.Network},
|
{Target: request.Network},
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: request.EnvProcess should only be set if it's not nil, otherwise we override anything in the Docker image already
|
|
||||||
|
|
||||||
spec := swarm.ServiceSpec{
|
spec := swarm.ServiceSpec{
|
||||||
TaskTemplate: swarm.TaskSpec{
|
TaskTemplate: swarm.TaskSpec{
|
||||||
RestartPolicy: &swarm.RestartPolicy{
|
RestartPolicy: &swarm.RestartPolicy{
|
||||||
@ -187,7 +184,6 @@ func makeSpec(request *requests.CreateFunctionRequest) swarm.ServiceSpec {
|
|||||||
},
|
},
|
||||||
ContainerSpec: swarm.ContainerSpec{
|
ContainerSpec: swarm.ContainerSpec{
|
||||||
Image: request.Image,
|
Image: request.Image,
|
||||||
Env: []string{fmt.Sprintf("fprocess=%s", request.EnvProcess)},
|
|
||||||
Labels: map[string]string{"function": "true"},
|
Labels: map[string]string{"function": "true"},
|
||||||
},
|
},
|
||||||
Networks: nets,
|
Networks: nets,
|
||||||
@ -196,5 +192,15 @@ func makeSpec(request *requests.CreateFunctionRequest) swarm.ServiceSpec {
|
|||||||
Name: request.Service,
|
Name: request.Service,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: request.EnvProcess should only be set if it's not nil, otherwise we override anything in the Docker image already
|
||||||
|
var env []string
|
||||||
|
if len(request.EnvProcess) > 0 {
|
||||||
|
env = append(env, fmt.Sprintf("fprocess=%s", request.EnvProcess))
|
||||||
|
}
|
||||||
|
if len(env) > 0 {
|
||||||
|
spec.TaskTemplate.ContainerSpec.Env = env
|
||||||
|
}
|
||||||
|
|
||||||
return spec
|
return spec
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user