diff --git a/prod/Dockerfile b/prod/Dockerfile index 93a18a7..7be305d 100644 --- a/prod/Dockerfile +++ b/prod/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.6 +FROM alpine:3.7 LABEL com.github.pottava.application="aws-s3-proxy" \ com.github.pottava.usage="docker run -d -p 8080:80 -e AWS_S3_BUCKET pottava/s3-proxy" \ @@ -9,31 +9,17 @@ ENV AWS_REGION=us-east-1 \ RUN apk add --no-cache ca-certificates -RUN apk --no-cache add --virtual build-dependencies bash gcc musl-dev openssl go git \ - - # Install go 1.9 - && GOLANG_VERSION=1.9.1 \ - && GOLANG_SRC_URL=https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz \ - && GOLANG_SRC_SHA256=a84afc9dc7d64fe0fa84d4d735e2ece23831a22117b50dafc75c1484f1cb550e \ - && export GOROOT_BOOTSTRAP="$(go env GOROOT)" \ - && wget -q "$GOLANG_SRC_URL" -O golang.tar.gz \ - && echo "$GOLANG_SRC_SHA256 golang.tar.gz" | sha256sum -c - \ - && tar -C /usr/local -xzf golang.tar.gz \ - && wget -q https://raw.githubusercontent.com/docker-library/golang/master/1.9/alpine3.6/no-pic.patch \ - && cd /usr/local/go/src \ - && patch -p2 -i /no-pic.patch \ - && ./make.bash \ +RUN apk --no-cache add --virtual build-dependencies gcc musl-dev go git \ && export GOPATH=/go \ - && mkdir -p /go/src /go/bin \ - && chmod -R 777 /go \ - - # Compile s3-proxy + && export PATH=$GOPATH/bin:$PATH \ + && mkdir $GOPATH \ + && chmod -R 777 $GOPATH \ && go get -u github.com/pottava/aws-s3-proxy \ - && mv /go/bin/aws-s3-proxy /usr/bin \ - - # Clean up + && cd /go/src/github.com/pottava/aws-s3-proxy \ + && go build -ldflags "-s -w" \ + && mv aws-s3-proxy /usr/bin \ && apk del --purge -r build-dependencies \ - && rm -rf /usr/local/go /usr/lib/go /go /golang.tar.gz /*.patch + && rm -rf /go EXPOSE 80