Skip to content

Commit

Permalink
Fix Dockerfile after change to Gradle build and improve build
Browse files Browse the repository at this point in the history
  • Loading branch information
Hartorn committed Sep 12, 2023
1 parent 94c33bb commit da9d0fb
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 26 deletions.
53 changes: 32 additions & 21 deletions .github/workflows/build-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@ on:
# schedule:
# - cron: '0 5 * * *'
workflow_dispatch:
pull_request: # TODO(Bazire): to remove before merge
# https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners

jobs:
build-images:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Set up Docker Buildx
id: builder
uses: docker/setup-buildx-action@master
uses: docker/setup-buildx-action@v3

- name: "Append ARM buildx builder from Oracle cloud"
uses: baschny/append-buildx-action@v1
Expand All @@ -36,24 +40,31 @@ jobs:
echo "tag=$SANITIZED_BRANCH" >> $GITHUB_OUTPUT
id: extract_branch

- name: Login to Docker registry
uses: docker/login-action@v2
# TODO(Bazire): to remove before merge
# - name: Login to Docker registry
# uses: docker/login-action@v3
# with:
# username: giskardai
# password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
username: giskardai
password: ${{ secrets.DOCKERHUB_TOKEN }}
context: .
push: false # TODO(Bazire): to change to true before merge
tags: giskardai/giskard:${{ steps.extract_branch.outputs.tag }}
builder: ${{ steps.builder.outputs.name }}
platforms: |
linux/arm64
linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
# https://github.com/docker/build-push-action/tree/v5/
# https://docs.docker.com/build/ci/github-actions/cache/#github-cache
# cache-from:
# cache-to:

- name: Build and push image based on the current branch
env:
IMAGE: docker.io/giskardai/giskard
run: |
docker buildx build \
--platform linux/amd64,linux/arm64 \
--tag $IMAGE:${{ steps.extract_branch.outputs.tag }} \
--file Dockerfile \
--push \
.
- name: Invoke deployment hook
if: ${{ steps.extract_branch.outputs.branch == 'main' }}
run: |
curl -L --silent --max-time 900 ${{ secrets.TEST_SERVER_WEBHOOK_URL_BASE }}/redeploy-dev
# - name: Invoke deployment hook
# if: ${{ steps.extract_branch.outputs.branch == 'main' }}
# run: |
# curl -L --silent --max-time 900 ${{ secrets.TEST_SERVER_WEBHOOK_URL_BASE }}/redeploy-dev
6 changes: 3 additions & 3 deletions .github/workflows/build_backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-depth: 1
- name: Extract branch name
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT
id: extract_branch
Expand Down Expand Up @@ -70,7 +70,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-depth: 1

- name: Set up JDK 17
uses: actions/setup-java@v3
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-depth: 1

- name: Set up JDK 17
uses: actions/setup-java@v3
Expand Down
13 changes: 11 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,20 @@ COPY gradle gradle
COPY .git .git

COPY build.gradle.kts gradle.properties gradlew settings.gradle.kts ./
# Install PDM
RUN curl -sSL https://pdm.fming.dev/install-pdm.py | python3 -
ENV PATH /root/.local/bin:$PATH

RUN ./gradlew clean install -Pprod --parallel --info --stacktrace
WORKDIR /app/python-client
RUN pdm run clean
# TODO(Bazire): have a complete pass over deps to ensure what is where
RUN pdm install -G :all
RUN pdm run test
RUN pdm run build

WORKDIR /app
RUN ./gradlew :backend:package -Pprod --parallel --info --stacktrace
RUN ./gradlew :frontend:package -Pprod --parallel --info --stacktrace
RUN ./gradlew :python-client:package -Pprod --parallel --info --stacktrace


# Create an environment and install giskard wheel. Some dependencies may require gcc which is only installed in build
Expand Down

0 comments on commit da9d0fb

Please sign in to comment.