forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 17
Make an image for the environment to build engine source #176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
WonyoungChoi
merged 4 commits into
flutter-tizen:flutter-2.2.1-tizen
from
WonyoungChoi:build-engine-docker
Sep 3, 2021
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
d5d06b8
Make an image for the environment to build engine source
WonyoungChoi 021a423
Remove hard-coded branch name in build-docker.sh
WonyoungChoi 1d91952
Add DEPS to path filter of the build-docker workflow.
WonyoungChoi b752f5c
Remove redundant lines of .gclient
WonyoungChoi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| name: Build Docker | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - 'flutter-*' | ||
| paths: | ||
| - 'ci/docker/tizen/**' | ||
| - 'DEPS' | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Extract branch name | ||
| id: branch | ||
| run: echo "##[set-output name=name;]$(echo ${GITHUB_REF#refs/heads/})" | ||
|
|
||
| - uses: actions/checkout@v2 | ||
|
|
||
| - uses: docker/setup-buildx-action@v1 | ||
|
|
||
| - uses: docker/login-action@v1 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.repository_owner }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Build and push | ||
| uses: docker/build-push-action@v2 | ||
| with: | ||
| context: ci/docker/tizen | ||
| file: ci/docker/tizen/Dockerfile | ||
| push: true | ||
| build-args: | ||
| GIT_BRANCH=${{ steps.branch.outputs.name }} | ||
| tags: | | ||
| ghcr.io/${{ github.repository_owner }}/build-engine:latest | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| ################# | ||
| # Builder stage # | ||
| ################# | ||
|
|
||
| FROM debian:buster-slim AS builder | ||
|
|
||
| ARG GIT_BRANCH | ||
|
|
||
| RUN apt-get update && \ | ||
| apt-get install -y git curl ca-certificates python && \ | ||
| apt-get clean | ||
|
|
||
| # Install depot tools. | ||
| ENV DEPOT_TOOLS_PATH=/usr/share/depot_tools | ||
| ENV PATH=$PATH:${DEPOT_TOOLS_PATH} | ||
| RUN git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git ${DEPOT_TOOLS_PATH} | ||
|
|
||
| # Sync engine and dependencies. | ||
| WORKDIR /engine | ||
| RUN if [ -n "$GIT_BRANCH" ]; then \ | ||
| git clone --depth 1 -b $GIT_BRANCH https://github.com/flutter-tizen/engine src/flutter; \ | ||
| else \ | ||
| git clone --depth 1 https://github.com/flutter-tizen/engine src/flutter; \ | ||
| fi | ||
|
|
||
| RUN gclient config --name="src/flutter" --deps-file="DEPS" --unmanaged https://github.com/flutter-tizen/engine.git | ||
| RUN gclient setdep --var=download_android_deps=False --deps-file=src/flutter/DEPS | ||
| RUN gclient sync -f -D --no-history --shallow | ||
|
|
||
| # Copy selected .git directories. | ||
| RUN mkdir -p cache | ||
| RUN for x in $(find src/third_party/ -name .git -a \( -wholename "*/dart/*" -o -wholename "*/skia/*" \)); do \ | ||
| mkdir -p cache/$x; \ | ||
| cp -fr $x/* cache/$x; \ | ||
| done | ||
|
|
||
|
|
||
| ############################# | ||
| # build-engine docker image # | ||
| ############################# | ||
|
|
||
| FROM ghcr.io/flutter-tizen/tizen-tools:latest | ||
|
|
||
| RUN apt-get update && \ | ||
| apt-get install -y git curl ca-certificates python xz-utils pkg-config \ | ||
| libncurses5 libfreetype6-dev && \ | ||
| apt-get clean | ||
|
|
||
| COPY --from=builder /usr/share/depot_tools /usr/share/depot_tools | ||
| COPY --from=builder /engine/cache /engine/cache | ||
| ADD prepare-sync.sh /engine/tools/ | ||
|
|
||
| ENV PATH=$PATH:/usr/share/depot_tools:/engine/tools |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| #!/bin/bash | ||
|
|
||
| IMAGE_NAME=ghcr.io/flutter-tizen/build-engine | ||
| IMAGE_TAG=latest | ||
|
|
||
| docker pull $IMAGE_NAME:$IMAGE_TAG | ||
| docker build --tag $IMAGE_NAME:$IMAGE_TAG . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| #!/bin/bash -e | ||
|
|
||
| DEPS=src/flutter/DEPS | ||
|
|
||
| if [ ! -f $DEPS ]; then | ||
| echo "Could not find DEPS file." | ||
| exit 1 | ||
| fi | ||
|
|
||
| cat > .gclient << EOF | ||
| solutions = [ | ||
| { "name" : 'src/flutter', | ||
| "url" : 'https://github.com/flutter-tizen/engine.git', | ||
| "deps_file" : 'DEPS', | ||
| "managed" : False, | ||
| }, | ||
| ] | ||
| EOF | ||
|
|
||
| gclient setdep --var=download_android_deps=False --deps-file=$DEPS | ||
|
|
||
| sed -i -e '/src\/ios_tools/,+2d' $DEPS | ||
| sed -i -e '/src\/third_party\/vulkan/,+2d' $DEPS | ||
| sed -i -e '/src\/third_party\/angle/,+2d' $DEPS | ||
| sed -i -e '/src\/third_party\/abseil-cpp/,+2d' $DEPS | ||
| sed -i -e '/src\/fuchsia\/sdk\/linux/,+9d' $DEPS | ||
|
|
||
| if [ -d /engine/cache ]; then | ||
| cp -fr /engine/cache/* . | ||
| fi |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: When I create a new branch (say)
flutter-2.4.0-tizenwith these files included, will the corresponding Docker image be generated automatically? Is there anything I need to know?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the image will be generated and pushed automatically when you push any changes of
ci/docker/tizen/**to flutter-* branches. But currently it will have same taglatest. I think it is better to push with multiple tagslatestand the branch nameflutter-2.4.0-tizenif the container registry allows the quota.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Engine 버전을 업데이트하는 동안에는 보통 서로 다른 두 DEPS가 동시에 사용이 됩니다. 예를 들어 제가 flutter-2.4.0-tizen에 첫 commit과 PR을 쓰더라도 기존의 PR들은 flutter-2.2.1-tizen을 타게팅하고 있기 때문에 2.4.0의 DEPS를 사용한 빌드와 2.2.1의 DEPS를 사용한 빌드가 자주 번갈아서 일어나게 됩니다. 빌드 전에 gclient sync를 항상 돌리기 때문에 큰 문제가 없을 수는 있지만 의도한 동작이 맞는지는 확인해보시기 바랍니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 Docker 이미지에서
gclient sync를 하는 이유는 engine 빌드시gclient sync시간이 상대적으로 오래걸리는 dart, skia 관련 repository의 .git directory를 이미지내에 미리 cache하기 위함입니다. 말씀하신 상황에서는 cache된 .git 디렉토리에서 commit hash를 찾지 못해 (shallow clone이므로) gclient sync가 조금 더 오래 걸리는 상황이 있긴 하겠지만, 큰 문제가 되지는 않을 것 같습니다.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use Korean now? 👀
BTW, What's wrong with your tone? Who use translator? 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bwikbs I rarely use Korean for some comments that I can't express in English quickly, only if the topic is not important for other reviewers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see. Now talk about
translatorpart 😄There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's wrong with my tone 😢
I try to use correct spelling and grammar to help Google translator translate my Korean comments.