1FROM golang:1.10.1-alpine AS build-env 2RUN apk add --update git gcc libc-dev 3# Pin to the specific v3.0.0 version 4RUN go get -tags 'mysql postgres file' github.com/mattes/migrate/cli && mv /go/bin/cli /go/bin/migrate 5 6ENV NOTARYPKG github.com/theupdateframework/notary 7 8# Copy the local repo to the expected go path 9COPY . /go/src/${NOTARYPKG} 10WORKDIR /go/src/${NOTARYPKG} 11 12# Build notary-signer 13RUN go install \ 14 -tags pkcs11 \ 15 -ldflags "-w -X ${NOTARYPKG}/version.GitCommit=`git rev-parse --short HEAD` -X ${NOTARYPKG}/version.NotaryVersion=`cat NOTARY_VERSION`" \ 16 ${NOTARYPKG}/cmd/notary-signer 17 18 19FROM busybox:latest 20 21# the ln is for compatibility with the docker-compose.yml, making these 22# images a straight swap for the those built in the compose file. 23RUN mkdir -p /usr/bin /var/lib && ln -s /bin/env /usr/bin/env 24 25COPY --from=build-env /go/bin/notary-signer /usr/bin/notary-signer 26COPY --from=build-env /go/bin/migrate /usr/bin/migrate 27COPY --from=build-env /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 28COPY --from=build-env /go/src/github.com/theupdateframework/notary/migrations/ /var/lib/notary/migrations 29COPY --from=build-env /go/src/github.com/theupdateframework/notary/fixtures /var/lib/notary/fixtures 30RUN chmod 0600 /var/lib/notary/fixtures/database/* 31 32WORKDIR /var/lib/notary 33# SERVICE_NAME needed for migration script 34ENV SERVICE_NAME=notary_signer 35ENV NOTARY_SIGNER_DEFAULT_ALIAS="timestamp_1" 36ENV NOTARY_SIGNER_TIMESTAMP_1="testpassword" 37 38ENTRYPOINT [ "/usr/bin/notary-signer" ] 39CMD [ "-config=/var/lib/notary/fixtures/signer-config-local.json" ] 40