xref: /aosp_15_r20/external/skia/infra/fiddler-backend/Dockerfile (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1FROM gcr.io/skia-public/fiddler-base@sha256:02e3ab2d1e4e0888b788b3adc6d6b955f283e73e0245a9f02552a6d654f33c4c
2
3# https://stackoverflow.com/a/44766666
4# Copy the skia files that Louhi has cloned into the image. Louhi hasn't synced third party
5# deps, so we will need to do that before compiling (see next steps).
6COPY --chown=skia:skia . /tmp/skia
7
8# We need to call gclient config so gclient sync works later to get our third party deps
9# We want --unmanaged to make gclient not sync Skia and instead use the files we copied
10# into the container.
11RUN cd /tmp && gclient config --unmanaged --name=skia https://skia.googlesource.com/skia.git
12
13WORKDIR /tmp/skia/
14
15# Fetch things we need but delete large third-party folders that we don't need for fiddler
16RUN ./bin/fetch-gn \
17  && ./bin/fetch-ninja \
18  && gclient sync \
19  && rm -rf third_party/externals/dawn \
20           third_party/externals/emsdk \
21           third_party/externals/icu4x \
22           third_party/externals/opengl-registry \
23           third_party/externals/perfetto \
24           third_party/externals/swiftshader \
25           third_party/externals/unicodetools
26
27RUN mkdir -p ./out/Static
28RUN echo '  \n\
29cc = "clang"  \n\
30cxx = "clang++"  \n\
31skia_use_egl = true  \n\
32is_debug = false  \n\
33skia_enable_fontmgr_fontconfig = true \n\
34skia_use_perfetto = false \n\
35skia_use_libgrapheme = false \n\
36skia_use_icu4x = false \n\
37skia_use_system_freetype2 = false  \n\
38link_pool_depth=2  \n\
39extra_cflags = [  \n\
40  "-I/tmp/swiftshader/include",  \n\
41  "-DGR_EGL_TRY_GLES3_THEN_GLES2",  \n\
42  "-g0",  \n\
43]  \n\
44extra_ldflags = [  \n\
45  "-L/usr/local/lib",  \n\
46  "-Wl,-rpath",  \n\
47  "-Wl,/usr/local/lib"  \n\
48] ' > ./out/Static/args.gn
49
50# Build Skia once so that incremental builds are much faster
51RUN ./bin/gn gen out/Static
52RUN git rev-parse HEAD > VERSION
53RUN ./third_party/ninja/ninja -C out/Static fiddle
54
55# Cleanup .git directories because they are not needed and take up space.
56# (can't do this sooner because we need to create VERSION)
57RUN find . -name .git -print0 | xargs -0 rm -rf
58