From c24c327151a0894329fafe5b8b881927945d5c00 Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Wed, 20 Nov 2019 20:57:50 +0100 Subject: [PATCH] build: fix build.Dockerfile + integrate into CircleCI fixup of 080f2c0616d536cc1887a1ab3120c760e86a2e07 fixup of 4994b7a9eaea199e8c8533be74a1a1cb7ec2e5fd --- .circleci/config.yml | 29 +++++++++++++++++++++++++++++ build.Dockerfile | 5 +++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7749f1e..5bd2c30 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,7 +7,9 @@ workflows: - build-1.12 - build-1.13 - build-latest + - test-build-in-docker jobs: + # build-latest serves as the template # we use YAML anchors & aliases to exchange the docker image (and hence Go version used for the build) build-latest: &build-latest @@ -108,3 +110,30 @@ jobs: <<: *build-latest docker: - image: circleci/golang:1.13 + + # this job tries to mimic the build-in-docker instructions + # given in docs/installation.rst + # + # However, CircleCI doesn't support volume mounts, so we have to copy + # the source into the build-container by modifying the Dockerfile + test-build-in-docker: + description: Check that build-in-docker works + docker: + - image: circleci/golang:latest + environment: + working_directory: /go/src/github.com/zrepl/zrepl + steps: + - checkout + - setup_remote_docker + - run: + name: (hacky) circleci doesn't allow volume mounts, so copy src to container + command: echo "ADD . /src" >> build.Dockerfile + - run: + name: (hacky) commit modified Dockerfile to avoid failing git clean check in Makefile + command: git -c user.name='circleci' -c user.email='circleci@localhost' commit -m 'CIRCLECI modified Dockerfile with zrepl src' --author 'autoauthor ' -- build.Dockerfile + - run: + name: build the build image (build deps) + command: docker build -t zrepl_build -f build.Dockerfile . + - run: + name: try compiling + command: docker run -it zrepl_build make release \ No newline at end of file diff --git a/build.Dockerfile b/build.Dockerfile index 9b86b33..a05f237 100644 --- a/build.Dockerfile +++ b/build.Dockerfile @@ -2,7 +2,8 @@ FROM golang:latest RUN apt-get update && apt-get install -y \ python3-pip \ - unzip + unzip \ + gawk ADD build.installprotoc.bash ./ RUN bash build.installprotoc.bash @@ -22,7 +23,7 @@ RUN mkdir -p /.cache && chmod -R 0777 /.cache WORKDIR /src # Install build tools (e.g. protobuf generator, stringer) into $GOPATH/bin -ADD go.mod go.sum ./ +ADD build/ /tmp/build RUN /tmp/lazy.sh godep RUN chmod -R 0777 /go