ci: create a docker image with browsercore deps

This commit is contained in:
Pierre Tachoire
2023-11-14 11:22:25 +01:00
parent ab75644dc8
commit d04e321b65
2 changed files with 94 additions and 0 deletions

60
.github/workflows/build-deps.yml vendored Normal file
View File

@@ -0,0 +1,60 @@
name: build-deps
on:
push:
branches:
- "master"
paths:
- 'vendor/lexbor-src/**'
- 'vendor/netsurf/**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: browsercore/browsercore-deps
ZIG_VERSION: 0.11.0
jobs:
build-deps:
strategy:
matrix:
include:
- os: linux
build_arch: amd64
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_CI_PAT }}
submodules: true
- name: Docker connect
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Docker build
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
file: Dockerfile.deps
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
labels: ${{ steps.meta.outputs.labels }}
build-args: |
ZIG_VERSION=${{ env.ZIG_VERSION }}
platforms: ${{matrix.os}}/${{matrix.build_arch}}

34
Dockerfile.deps Normal file
View File

@@ -0,0 +1,34 @@
# This dockerfile is used to build browsercore vendor dependencies except
# jsruntime-lib v8.
# jsruntime-lib v8 is built via zig-v8-fork/Dockerfile.
ARG ZIG_VERSION=0.11.0
FROM ghcr.io/browsercore/zig:${ZIG_VERSION} as build
# Install required dependencies
RUN apt update && \
apt install -y git curl bash xz-utils python3 ca-certificates pkg-config \
libglib2.0-dev gperf libexpat1-dev cmake build-essential
COPY ./Makefile /src/
WORKDIR /src
# build lexbor
ADD ./vendor/lexbor-src /src/vendor/lexbor-src
RUN make install-lexbor
# build libiconv
RUN make install-libiconv
# build netsurf
ADD ./vendor/netsurf /src/vendor/netsurf
RUN make install-netsurf
FROM scratch as artifact
COPY --from=build /src/vendor/libiconv /usr/local/lib/libiconv
COPY --from=build /src/vendor/lexbor /usr/local/lib/lexbor
COPY --from=build /src/vendor/netsurf/build /usr/local/lib/netsurf/build
COPY --from=build /src/vendor/netsurf/lib /usr/local/lib/netsurf/lib
COPY --from=build /src/vendor/netsurf/include /usr/local/lib/netsurf/include