mirror of
https://github.com/openfaas/faas.git
synced 2025-06-16 21:06:54 +00:00
Format and add multi-stage Dockerfile
This commit is contained in:
parent
968002c15f
commit
024bd5419b
@ -18,8 +18,8 @@ EXPOSE 8080
|
||||
ENV http_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"]
|
@ -174,11 +174,8 @@ func makeSpec(request *requests.CreateFunctionRequest) swarm.ServiceSpec {
|
||||
max := uint64(1)
|
||||
|
||||
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{
|
||||
TaskTemplate: swarm.TaskSpec{
|
||||
RestartPolicy: &swarm.RestartPolicy{
|
||||
@ -187,7 +184,6 @@ func makeSpec(request *requests.CreateFunctionRequest) swarm.ServiceSpec {
|
||||
},
|
||||
ContainerSpec: swarm.ContainerSpec{
|
||||
Image: request.Image,
|
||||
Env: []string{fmt.Sprintf("fprocess=%s", request.EnvProcess)},
|
||||
Labels: map[string]string{"function": "true"},
|
||||
},
|
||||
Networks: nets,
|
||||
@ -196,5 +192,15 @@ func makeSpec(request *requests.CreateFunctionRequest) swarm.ServiceSpec {
|
||||
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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user