Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build Docker

on:
push:
branches:
- 'flutter-*'
Copy link
Member

@swift-kim swift-kim Aug 31, 2021

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-tizen with these files included, will the corresponding Docker image be generated automatically? Is there anything I need to know?

Copy link
Author

@WonyoungChoi WonyoungChoi Aug 31, 2021

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 tag latest. I think it is better to push with multiple tags latest and the branch name flutter-2.4.0-tizen if the container registry allows the quota.

Copy link
Member

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를 항상 돌리기 때문에 큰 문제가 없을 수는 있지만 의도한 동작이 맞는지는 확인해보시기 바랍니다.

Copy link
Author

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가 조금 더 오래 걸리는 상황이 있긴 하겠지만, 큰 문제가 되지는 않을 것 같습니다.

Copy link
Member

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? 😄

Copy link
Member

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.

Copy link
Member

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 translator part 😄

Copy link
Member

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.

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
53 changes: 53 additions & 0 deletions ci/docker/tizen/Dockerfile
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
7 changes: 7 additions & 0 deletions ci/docker/tizen/build-docker.sh
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 .
30 changes: 30 additions & 0 deletions ci/docker/tizen/prepare-sync.sh
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