From 6e28ea6bdc00b313b62198be4417a9ff56cb1189 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Thu, 8 Apr 2021 20:06:48 +0200 Subject: [PATCH] Use pre-prepared Docker image in CI to speed things up --- .drone.yml | 36 ++++++++------------------------- script/builder_image/Dockerfile | 6 ++++++ script/builder_image/Makefile | 8 ++++++++ 3 files changed, 22 insertions(+), 28 deletions(-) create mode 100644 script/builder_image/Dockerfile create mode 100644 script/builder_image/Makefile diff --git a/.drone.yml b/.drone.yml index 68cfa3e8..2d071671 100644 --- a/.drone.yml +++ b/.drone.yml @@ -28,42 +28,31 @@ steps: cache_key: '{{ .Repo.Name }}_{{ checksum "Cargo.lock" }}_{{ arch }}_{{ os }}_gzip' region: garage mount: - - 'target' - - '/drone/cargo/registry/index' - - '/drone/cargo/registry/cache' - - '/drone/cargo/bin' - - '/drone/cargo/git/db' + - '/drone/cargo' + #- 'target' path_style: true endpoint: https://garage.deuxfleurs.fr - when: - branch: - - nonexistent_skip_this_step - name: build - image: rust:buster + image: lxpz/garage_builder_amd64:1 volumes: - name: cargo_home path: /drone/cargo environment: CARGO_HOME: /drone/cargo commands: - - apt-get update - - apt-get install --yes libsodium-dev - - rustup component add rustfmt - pwd - cargo fmt -- --check - cargo build - name: cargo-test - image: rust:buster + image: lxpz/garage_builder_amd64:1 volumes: - name: cargo_home path: /drone/cargo environment: CARGO_HOME: /drone/cargo commands: - - apt-get update - - apt-get install --yes libsodium-dev - cargo test - name: rebuild-cache @@ -84,28 +73,19 @@ steps: cache_key: '{{ .Repo.Name }}_{{ checksum "Cargo.lock" }}_{{ arch }}_{{ os }}_gzip' region: garage mount: - - 'target' - - '/drone/cargo/registry/index' - - '/drone/cargo/registry/cache' - - '/drone/cargo/git/db' - - '/drone/cargo/bin' + - '/drone/cargo' + #- 'target' path_style: true endpoint: https://garage.deuxfleurs.fr - when: - branch: - - nonexistent_skip_this_step - name: smoke-test - image: rust:buster + image: lxpz/garage_builder_amd64:1 volumes: - name: cargo_home path: /drone/cargo environment: CARGO_HOME: /drone/cargo commands: - - apt-get update - - apt-get install --yes libsodium-dev awscli python-pip - - pip install s3cmd - ./script/test-smoke.sh || (cat /tmp/garage.log; false) --- @@ -143,6 +123,6 @@ steps: --- kind: signature -hmac: f16004516ebe576dd60b561738b707e34d258dc137b12c63715fdde4c86b7d58 +hmac: af2fc8228c885d0f9a3326bf6f1e21cb85aef494a57a70608487ad47161ab1d2 ... diff --git a/script/builder_image/Dockerfile b/script/builder_image/Dockerfile new file mode 100644 index 00000000..292d551d --- /dev/null +++ b/script/builder_image/Dockerfile @@ -0,0 +1,6 @@ +FROM rust:buster +RUN apt-get update && \ + apt-get install --yes libsodium-dev awscli python-pip && \ + rm -rf /var/lib/apt/lists/* +RUN rustup component add rustfmt +RUN pip install s3cmd diff --git a/script/builder_image/Makefile b/script/builder_image/Makefile new file mode 100644 index 00000000..00b0f6c7 --- /dev/null +++ b/script/builder_image/Makefile @@ -0,0 +1,8 @@ +DOCKER=lxpz/garage_builder_amd64 + +docker: + docker build -t $(DOCKER):$(TAG) . + docker push $(DOCKER):$(TAG) + docker tag $(DOCKER):$(TAG) $(DOCKER):latest + docker push $(DOCKER):latest +