build: fix build.Dockerfile + integrate into CircleCI

fixup of 080f2c0616
fixup of 4994b7a9ea
This commit is contained in:
Christian Schwarz 2019-11-20 20:57:50 +01:00
parent 5e17d7ba80
commit c24c327151
2 changed files with 32 additions and 2 deletions

View File

@ -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 <circleci@localhost>' -- 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

View File

@ -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