Skip to content

Commit

Permalink
docker: Enable the sample hook files to execute without error (tus#256)
Browse files Browse the repository at this point in the history
- Include jq package in the Dockerfile for parsing JSON
- Use sh instead of bash which is not available in Alpine Linux
  • Loading branch information
rija authored and Acconut committed Mar 30, 2019
1 parent 56acce8 commit 82bd6c7
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .hooks/post-create
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

id="$TUS_ID"
offset="$TUS_OFFSET"
Expand Down
2 changes: 1 addition & 1 deletion .hooks/post-finish
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

echo "Upload $TUS_ID ($TUS_SIZE bytes) finished"
cat /dev/stdin | jq .
2 changes: 1 addition & 1 deletion .hooks/post-receive
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

id="$TUS_ID"
offset="$TUS_OFFSET"
Expand Down
2 changes: 1 addition & 1 deletion .hooks/post-terminate
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

echo "Upload $TUS_ID terminated"
cat /dev/stdin | jq .
2 changes: 1 addition & 1 deletion .hooks/pre-create
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

filename=$(cat /dev/stdin | jq .MetaData.filename)
if [ -z "$filename" ]; then
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ FROM alpine:3.8

COPY --from=builder /go/bin/tusd /usr/local/bin/tusd

RUN apk add --no-cache ca-certificates \
RUN apk add --no-cache ca-certificates jq \
&& addgroup -g 1000 tusd \
&& adduser -u 1000 -G tusd -s /bin/sh -D tusd \
&& mkdir -p /srv/tusd-hooks \
Expand Down

0 comments on commit 82bd6c7

Please sign in to comment.