2017-05-29 21:21:53 +00:00
|
|
|
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-hooks \
|
|
|
|
&& rm -r /go/src/* \
|
|
|
|
&& apk del git
|
|
|
|
|
2018-01-04 16:25:30 +00:00
|
|
|
COPY entrypoint.sh /srv/entrypoint.sh
|
2017-05-29 21:21:53 +00:00
|
|
|
WORKDIR /srv/tusd-data
|
|
|
|
EXPOSE 1080
|
|
|
|
USER tusd
|
2018-01-04 16:25:30 +00:00
|
|
|
ENTRYPOINT ["/srv/entrypoint.sh"]
|