[#696] Reuse linux binaries for docker builds

* Reuse linux binary in docker build

* Have a dedicated Dockerfile for CI

* Reuse linux binary in GH Actions

* Make docker action depend only on linux

* Run Actions only on master
This commit is contained in:
Rahuλ Dé 2021-01-02 16:00:28 +01:00 committed by GitHub
parent ee22efdb40
commit 922de495e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 38 additions and 12 deletions

View file

@ -119,6 +119,10 @@ jobs:
command: |
script/test
script/run_lib_tests
- persist_to_workspace:
root: ./
paths:
- bb
- run:
name: Release
command: |
@ -144,7 +148,7 @@ jobs:
GRAALVM_HOME: /home/circleci/graalvm-ce-java11-20.3.0
BABASHKA_PLATFORM: linux-static # used in release script
BABASHKA_TEST_ENV: native
BABASHKA_STATIC: true
BABASHKA_STATIC: "true"
BABASHKA_XMX: "-J-Xmx6500m"
resource_class: large
steps:
@ -303,6 +307,8 @@ jobs:
- image: circleci/buildpack-deps:stretch
steps:
- checkout
- attach_workspace:
at: ./
- run:
name: "Pull Submodules"
command: |
@ -336,7 +342,4 @@ workflows:
branches:
only: master
requires:
- jvm
- linux
- linux-static
- mac

View file

@ -17,7 +17,7 @@ fi
if [ -z "$CIRCLE_PULL_REQUEST" ] && [ "$CIRCLE_BRANCH" = "master" ]; then
echo "Building Docker image $image_name:$image_tag"
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USER" --password-stdin
docker build -t "$image_name" --build-arg BABASHKA_XMX="-J-Xmx6300m" .
docker build -t "$image_name" -f Dockerfile.ci .
docker tag "$image_name:$latest_tag" "$image_name:$image_tag"
# we only update latest when it's not a SNAPSHOT version
if [ "false" = "$snapshot" ]; then

View file

@ -19,7 +19,7 @@ if [ -z "$GITHUB_HEAD_REF" ] && [ "${GITHUB_REF##*/}" = "master" ]
then
echo "Building Docker image $image_name:$image_tag"
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USER" --password-stdin
docker build -t "$image_name" --build-arg BABASHKA_XMX="-J-Xmx6300m" .
docker build -t "$image_name" -f Dockerfile.ci .
docker tag "$image_name:$latest_tag" "$image_name:$image_tag"
# we only update latest when it's not a SNAPSHOT version
if [ "false" = "$snapshot" ]; then

View file

@ -1,8 +1,9 @@
name: build
on: [push
, pull_request
]
on:
push:
branches:
- master
jobs:
@ -30,7 +31,7 @@ jobs:
with:
fetch-depth: 1
submodules: 'true'
- name: Cache deps
uses: actions/cache@v1
id: cache-deps
@ -164,6 +165,13 @@ jobs:
export GRAALVM_HOME="$HOME/graalvm-ce-java11-20.3.0"
BABASHKA_TEST_ENV=native script/test
- name: Save binary
uses: actions/upload-artifact@v2
with:
name: bb-linux-binary
path: |
bb
- name: Install clojure
run: |
sudo script/install-clojure /usr/local
@ -263,7 +271,7 @@ jobs:
mac:
if: "!contains(github.event.head_commit.message, 'skip ci')"
needs: [jvm]
runs-on: macOS-latest
runs-on: macos-latest
steps:
- name: Git checkout
uses: actions/checkout@v1
@ -358,7 +366,7 @@ jobs:
docker:
if: "!contains(github.event.head_commit.message, 'skip ci') && github.event_name == 'push' && github.ref == 'refs/heads/master'"
needs: [jvm, linux, linux-static, mac]
needs: [linux]
runs-on: ubuntu-18.04
steps:
- name: Git checkout
@ -367,6 +375,12 @@ jobs:
fetch-depth: 1
submodules: 'true'
- name: Download linux binary
uses: actions/download-artifact@v2
with:
name: bb-linux-binary
path: bb
- name: Docker build
env:
DOCKERHUB_USER: "${{ secrets.DOCKERHUB_USER }}"

9
Dockerfile.ci Normal file
View file

@ -0,0 +1,9 @@
FROM ubuntu:latest
RUN apt-get update \
&& apt-get install -y curl \
&& mkdir -p /usr/local/bin
COPY bb /usr/local/bin/bb
CMD ["bb"]