From 878ad8da1ffd7770c585c5ea4495b86a0ec2bcd2 Mon Sep 17 00:00:00 2001 From: arekkas Date: Tue, 12 Dec 2017 12:55:39 +0100 Subject: [PATCH] Reintroduces alpine based docker image Closes #703 --- .circleci/config.yml | 3 +++ Dockerfile-alpine | 27 +++++++++++++++++++++++++++ UPGRADE.md | 2 ++ 3 files changed, 32 insertions(+) create mode 100644 Dockerfile-alpine diff --git a/.circleci/config.yml b/.circleci/config.yml index 99392ccda49..48ec6bad07e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -63,6 +63,7 @@ jobs: - setup_remote_docker: version: 17.10.0-ce - run: docker build -f Dockerfile -t hydra-test . + - run: docker build -f Dockerfile-alpine -t hydra-test-alpine . - run: docker run hydra-test help release: @@ -84,8 +85,10 @@ jobs: - run: ghr -t $GITHUB_TOKEN -u $CIRCLE_PROJECT_USERNAME -r $CIRCLE_PROJECT_REPONAME --replace `git describe --tags` dist/ # Build and push docker image - run: docker build --build-arg git_tag=$(git describe --tags) --build-arg git_commit=$(git rev-parse HEAD) -f Dockerfile -t oryd/hydra:$CIRCLE_TAG . + - run: docker build --build-arg git_tag=$(git describe --tags) --build-arg git_commit=$(git rev-parse HEAD) -f Dockerfile-alpine -t oryd/hydra:$CIRCLE_TAG-alpine . - run: docker login --username "$DOCKER_USERNAME" --password "$DOCKER_PASSWORD" - run: docker push oryd/hydra:$CIRCLE_TAG + - run: docker push oryd/hydra:$CIRCLE_TAG-alpine # Release node / JavaScript SDK - run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc - run: sudo npm i -g npm diff --git a/Dockerfile-alpine b/Dockerfile-alpine new file mode 100644 index 00000000000..e5217c661c0 --- /dev/null +++ b/Dockerfile-alpine @@ -0,0 +1,27 @@ +FROM golang:1.9-alpine + +ARG git_tag +ARG git_commit + +RUN apk add --no-cache git build-base curl +RUN curl -L -s https://github.com/golang/dep/releases/download/v0.3.2/dep-linux-amd64 -o $GOPATH/bin/dep +RUN chmod +x $GOPATH/bin/dep + +WORKDIR /go/src/github.com/ory/hydra + +ADD ./Gopkg.lock ./Gopkg.lock +ADD ./Gopkg.toml ./Gopkg.toml +RUN dep ensure -vendor-only + +ADD . . + +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -X github.com/ory/hydra/cmd.Version=$git_tag -X github.com/ory/hydra/cmd.BuildTime=`TZ=UTC date -u '+%Y-%m-%dT%H:%M:%SZ'` -X github.com/ory/hydra/cmd.GitHash=$git_commit" -a -installsuffix cgo -o hydra + +FROM alpine:3.7 + +COPY --from=0 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ +COPY --from=0 /go/src/github.com/ory/hydra/hydra /usr/bin/hydra + +ENTRYPOINT ["hydra"] + +CMD ["host"] diff --git a/UPGRADE.md b/UPGRADE.md index 5e77e7fe139..f6b1233f99c 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -235,6 +235,8 @@ a shell, which makes it harder to penetrate. Instead of relying on tags to pass arguments, it is now possible to pass command arguments such as `docker run oryd/hydra:v0.10.0 host --dangerous-force-http` directly. +**Version 0.10.8 reintroduces an image with a shell, appended with tag `-alpine`.** + ### Important Additions #### Prefixing Resources Names