From 82bd6c796a6dd55b1c28f85c34070e14cd102251 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rija=20M=C3=A9nag=C3=A9?= Date: Sun, 31 Mar 2019 01:16:53 +0800 Subject: [PATCH] docker: Enable the sample hook files to execute without error (#256) - Include jq package in the Dockerfile for parsing JSON - Use sh instead of bash which is not available in Alpine Linux --- .hooks/post-create | 2 +- .hooks/post-finish | 2 +- .hooks/post-receive | 2 +- .hooks/post-terminate | 2 +- .hooks/pre-create | 2 +- Dockerfile | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.hooks/post-create b/.hooks/post-create index f25d9d5..b9d79a2 100755 --- a/.hooks/post-create +++ b/.hooks/post-create @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh id="$TUS_ID" offset="$TUS_OFFSET" diff --git a/.hooks/post-finish b/.hooks/post-finish index 03c059a..b66e16b 100755 --- a/.hooks/post-finish +++ b/.hooks/post-finish @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh echo "Upload $TUS_ID ($TUS_SIZE bytes) finished" cat /dev/stdin | jq . diff --git a/.hooks/post-receive b/.hooks/post-receive index 5f98009..06b8ea0 100755 --- a/.hooks/post-receive +++ b/.hooks/post-receive @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh id="$TUS_ID" offset="$TUS_OFFSET" diff --git a/.hooks/post-terminate b/.hooks/post-terminate index 2374ef9..c4e0b13 100755 --- a/.hooks/post-terminate +++ b/.hooks/post-terminate @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh echo "Upload $TUS_ID terminated" cat /dev/stdin | jq . diff --git a/.hooks/pre-create b/.hooks/pre-create index 4501f89..a031ee9 100755 --- a/.hooks/pre-create +++ b/.hooks/pre-create @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh filename=$(cat /dev/stdin | jq .MetaData.filename) if [ -z "$filename" ]; then diff --git a/Dockerfile b/Dockerfile index 91532ad..ffd48e9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 \