Skip to content

Commit

Permalink
Make Dockerfile more generic
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Ellis <[email protected]>
  • Loading branch information
alexellis committed Oct 27, 2017
1 parent baa728f commit 32c3a29
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions commands/new_function.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,20 @@ the "Dockerfile" lang type in your YAML file.
if strings.ToLower(lang) != "dockerfile" {
builder.CopyFiles("./template/"+lang+"/function/", "./"+functionName+"/", true)
} else {
ioutil.WriteFile("./"+functionName+"/Dockerfile", []byte(`# Use any image as your base image, or "scratch"
ioutil.WriteFile("./"+functionName+"/Dockerfile", []byte(`FROM alpine:3.6
# Use any image as your base image, or "scratch"
# Add fwatchdog binary via https://github.com/openfaas/faas/releases/
# Then set fprocess to the process you want to invoke per request - i.e. "cat" or "my_binary"
# FROM ...
# ADD https://...
# ENV fprocess=./my_binary
# CMD ["fwatchdog"]
ADD https://github.com/openfaas/faas/releases/download/0.6.7/fwatchdog /usr/bin
# COPY ./fwatchdog /usr/bin/
RUN chmod +x /usr/bin/fwatchdog
# Populate example here - i.e. "cat", "sha512sum" or "node index.js"
ENV fprocess="wc -l"
HEALTHCHECK --interval=5s CMD [ -e /tmp/.lock ] || exit 1
CMD ["fwatchdog"]
`), 0600)
}

Expand Down

0 comments on commit 32c3a29

Please sign in to comment.