From ba0f004df74f8ca18fb1e93cb08232fcf5c32741 Mon Sep 17 00:00:00 2001 From: FLANEUR Date: Mon, 29 May 2017 23:21:53 +0200 Subject: [PATCH] Add Dockerfile (#129) * working alpine Dockerfile usable for local and autobuild * removed volumes --- Dockerfile | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1c61c03 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +FROM golang:1.7-alpine + +# Copy in the git repo from the build context +COPY . /go/src/github.com/tus/tusd/ + +# Create app directory + +RUN addgroup -g 1000 tusd \ + && adduser -u 1000 -G tusd -s /bin/sh -D tusd \ + && cd /go/src/github.com/tus/tusd \ + && apk add --no-cache \ + git \ + && go get -d -v ./... \ + && version="$(git tag -l --points-at HEAD)" \ + && commit=$(git log --format="%H" -n 1) \ + && GOOS=linux GOARCH=amd64 go build \ + -ldflags="-X github.com/tus/tusd/cmd/tusd/cli.VersionName=${version} -X github.com/tus/tusd/cmd/tusd/cli.GitCommit=${commit} -X 'github.com/tus/tusd/cmd/tusd/cli.BuildDate=$(date --utc)'" \ + -o "/go/bin/tusd" ./cmd/tusd/main.go \ + && mkdir -p /srv/tusd-data \ + && mkdir -p /srv/tusd-hooks \ + && chown tusd:tusd /srv/tusd-data \ + && rm -r /go/src/* \ + && apk del git + +WORKDIR /srv/tusd-data +EXPOSE 1080 +USER tusd +ENTRYPOINT ["/go/bin/tusd","-dir","/srv/tusd-data","--hooks-dir","/srv/tusd-hooks"]