Skip to content

Commit

Permalink
Add docker job to CI (#895)
Browse files Browse the repository at this point in the history
Co-authored-by: Julian Pasquale <[email protected]>
  • Loading branch information
axelpontetto and JulianPasquale authored Nov 20, 2024
1 parent 30849fd commit b8e31b7
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,38 @@ env:
PARALLEL_TEST_FIRST_IS_1: true

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.head_ref || github.ref_name }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-${{ github.head_ref || github.ref_name }}
${{ runner.os }}-buildx-main
${{ runner.os }}-buildx-
- name: Build prod Docker image
uses: docker/build-push-action@v6
with:
push: false
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
file: Dockerfile

- # Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
linters:
name: Linters
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions docs/ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,6 @@ When splitting tests in different nodes, each report covers only a part of the c
For this reason a job in the CI is added to sums coverages from all nodes to be used by SimpleCov. This job will be executed after all nodes have finished and will send the final report to CodeClimate.

For the case of CPU cores we do not need to add extra configuration since the report of each node contains the info of all the cores that have been splited.

## Build production Docker image
As part of our CI process, we introduced a job called Docker that builds a Docker image using the `Dockerfile` that is part of this repository. This job helps us to guarantee the code we are trying to merge produces a valid Docker image and can be safely released to production.

0 comments on commit b8e31b7

Please sign in to comment.