Skip to content

Commit

Permalink
Image build fails when runtime deps fail to download.
Browse files Browse the repository at this point in the history
  • Loading branch information
rjew committed Jun 15, 2018
1 parent 39f6270 commit 28a0115
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -59,7 +59,7 @@ module.exports = function (context, payload) {
```

```bash
$ dispatch create function nodejs-mylibs math-js ./demo.js
$ dispatch create function math-js ./demo.js --image=nodejs-mylibs --handler=demo.js
```

Make sure the function status is `READY` (it normally goes from `INITIALIZED` to `READY`):
Expand Down
6 changes: 3 additions & 3 deletions function-template/Dockerfile
Expand Up @@ -10,9 +10,9 @@ COPY . .

# Create handler file if passed in otherwise assume default handler
RUN echo -n ${HANDLER} > /tmp/handler
RUN [ -z "${HANDLER}" ] && \
[ $(ls *.js | wc -l) -eq "1" ] && \
ls *.js > /tmp/handler || :
RUN if [ -z "${HANDLER}" ]; then \
([ $(ls *.js | wc -l) -eq "1" ] || (echo "Exactly 1 source file needed when HANDLER is empty" >&2 && exit 1)) && \
ls *.js > /tmp/handler; fi

# Validate function file and given handler
RUN node /validator/validator.js ${WORKDIR}/$(cat /tmp/handler) || (echo "Invalid function file or handler" >&2 && exit 1)
6 changes: 3 additions & 3 deletions image-template/Dockerfile
Expand Up @@ -8,12 +8,12 @@ ARG SYSTEM_PACKAGES_FILE=system-packages.txt
COPY ${SYSTEM_PACKAGES_FILE} .

RUN packages=$(cat ${SYSTEM_PACKAGES_FILE} | sed 's/ /-/' | uniq | paste -d' ' -); \
[ -n "${packages}" ] && tdnf install -y ${packages} || :
if [ -n "${packages}" ]; then tdnf install -y ${packages}; fi


WORKDIR ${WORKDIR}/..
WORKDIR /

ARG PACKAGES_FILE=packages.txt
COPY ${PACKAGES_FILE} package.json

RUN pj=$(cat package.json); [ -n "${pj}" ] && npm install || :
RUN pj=$(cat package.json); if [ -n "${pj}" ]; then npm install; fi
2 changes: 1 addition & 1 deletion version.txt
@@ -1 +1 @@
0.0.9
0.0.10

0 comments on commit 28a0115

Please sign in to comment.