diff --git a/README.md b/README.md index a573f38..4bc7dfe 100644 --- a/README.md +++ b/README.md @@ -5,13 +5,12 @@ - [Introduction](#introduction) - [Requirements](#requirements) -- [Building](#building) - - [Local Registry](#local-registry) -- [Cleanup](#cleanup) +- [Host-platform Builds](#host-platform-builds) +- [Multi-platform builds](#multi-platform-builds) ## Introduction -This repository provides the `islandora/leptonica` image which only exists +This repository provides the `islandora/imagemagick` image which only exists to provide a custom Alpine APK package(s). Since this does not change often and takes a very long time to cross compile for @@ -21,62 +20,33 @@ both platforms it's been moved to it's own repository. To build the Docker images using the provided Gradle build scripts requires: -- [Docker 19.03+](https://docs.docker.com/get-docker/) -- [mkcert](https://github.com/FiloSottile/mkcert) +- [Docker 20+](https://docs.docker.com/get-docker/) -## Building +## Host-platform Builds You can build your host platform locally using the default builder like so. ```bash -docker buildx bake --builder default +docker context use default +docker buildx bake ``` -### Local Registry +## Multi-platform builds To test multi-arch builds and remote build caching requires setting up a local registry. -You need to generate certificates for the local registry: +Please use [isle-builder] to create a builder to simplify this process. Using +the defaults provided, .e.g: -```bash -mkcert -install -cp $(mkcert -CAROOT)/* certs/ -mkcert -cert-file ./certs/cert.pem -key-file ./certs/privkey.pem "*.islandora.dev" "islandora.dev" "*.islandora.io" "islandora.io" "*.islandora.info" "islandora.info" "localhost" "127.0.0.1" "::1" -``` - -A docker compose file is provided to setup a local registry: - -```bash -docker compose up -d -``` - -Once the registry is setup can create a builder: - -```bash -docker buildx create \ - --bootstrap \ - --config buildkitd.toml \ - --driver-opt "image=moby/buildkit:v0.11.1,network=isle-leptonica" \ - --name "isle-leptonica" ``` - -Now you can perform the build locally by pushing to the local registry: - -```bash -REGISTRY=islandora.io docker buildx bake --builder isle-leptonica ci --push +make start ``` -## Cleanup - -Remove the builder: +After which you should be able to build with the following command: ```bash -docker buildx rm isle-leptonica +REPOSITORY=islandora.io docker buildx bake --builder isle-builder ci --push ``` -Remove the registry: - -```bash -docker compose down -v -``` +[isle-builder]: https://github.com/Islandora-Devops/isle-builder \ No newline at end of file diff --git a/buildkitd.toml b/buildkitd.toml deleted file mode 100644 index 1ccadc0..0000000 --- a/buildkitd.toml +++ /dev/null @@ -1,11 +0,0 @@ -[worker.containerd] - enabled = false -[worker.oci] - enabled = true - gc = false -[registry."islandora.io"] - insecure=false - ca=["./certs/rootCA.pem"] - [[registry."islandora.io".keypair]] - key="./certs/privkey.pem" - cert="./certs/cert.pem" \ No newline at end of file diff --git a/certs/.gitkeep b/certs/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/docker-bake.hcl b/docker-bake.hcl index cf28255..0c00b9a 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -1,27 +1,16 @@ -############################################################################### -# Variables -############################################################################### -variable "REPOSITORY" { - default = "islandora" -} - -variable "CACHE_FROM_REPOSITORY" { - default = "islandora" +variable "SOURCE_DATE_EPOCH" { + default = "0" } -variable "CACHE_TO_REPOSITORY" { +variable "REPOSITORY" { default = "islandora" } variable "TAG" { - # "local" is to distinguish that from builds produced locally. + # "local" is to distinguish remote images from those produced locally. default = "local" } -variable "SOURCE_DATE_EPOCH" { - default = "0" -} - ############################################################################### # Functions ############################################################################### @@ -37,12 +26,12 @@ function "tags" { function "cacheFrom" { params = [image, arch] - result = ["type=registry,ref=${CACHE_FROM_REPOSITORY}/cache:${image}-main-${arch}", "type=registry,ref=${CACHE_FROM_REPOSITORY}/cache:${image}-${TAG}-${arch}"] + result = ["type=registry,ref=${REPOSITORY}/cache:${image}-main-${arch}", "type=registry,ref=${REPOSITORY}/cache:${image}-${TAG}-${arch}"] } function "cacheTo" { params = [image, arch] - result = ["type=registry,oci-mediatypes=true,mode=max,compression=estargz,compression-level=5,ref=${CACHE_TO_REPOSITORY}/cache:${image}-${TAG}-${arch}"] + result = ["type=registry,oci-mediatypes=true,mode=max,compression=estargz,compression-level=5,ref=${REPOSITORY}/cache:${image}-${TAG}-${arch}"] } ############################################################################### @@ -50,7 +39,7 @@ function "cacheTo" { ############################################################################### group "default" { targets = [ - "leptonica" + "leptonica", ] } @@ -75,7 +64,7 @@ group "ci" { } ############################################################################### -# Common target properties. +# Targets ############################################################################### target "common" { args = { @@ -86,14 +75,6 @@ target "common" { } } -target "amd64-common" { - platforms = ["linux/amd64"] -} - -target "arm64-common" { - platforms = ["linux/arm64"] -} - target "leptonica-common" { inherits = ["common"] context = "leptonica" @@ -101,29 +82,16 @@ target "leptonica-common" { # The digest (sha256 hash) is not platform specific but the digest for the manifest of all platforms. # It will be the digest printed when you do: docker pull alpine:3.17.1 # Not the one displayed on DockerHub. - # N.B. This should match the value used in: - # - - # - + # N.B. This should match the value used in alpine = "docker-image://alpine:3.19.1@sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b" } } -############################################################################### -# Default Image targets for local builds. -############################################################################### -target "leptonica" { - inherits = ["leptonica-common"] - cache-from = cacheFrom("leptonica", hostArch()) - tags = tags("leptonica", "") -} - -############################################################################### -# linux/amd64 targets. -############################################################################### target "leptonica-amd64" { - inherits = ["leptonica-common", "amd64-common"] - cache-from = cacheFrom("leptonica", "amd64") + inherits = ["leptonica-common"] tags = tags("leptonica", "amd64") + cache-from = cacheFrom("leptonica", "amd64") + platforms = ["linux/amd64"] } target "leptonica-amd64-ci" { @@ -131,16 +99,20 @@ target "leptonica-amd64-ci" { cache-to = cacheTo("leptonica", "amd64") } -############################################################################### -# linux/arm64 targets. -############################################################################### target "leptonica-arm64" { - inherits = ["leptonica-common", "arm64-common"] - cache-from = cacheFrom("leptonica", "arm64") + inherits = ["leptonica-common"] tags = tags("leptonica", "arm64") + cache-from = cacheFrom("leptonica", "arm64") + platforms = ["linux/arm64"] } target "leptonica-arm64-ci" { inherits = ["leptonica-arm64"] cache-to = cacheTo("leptonica", "arm64") -} \ No newline at end of file +} + +target "leptonica" { + inherits = ["leptonica-common"] + cache-from = cacheFrom("leptonica", hostArch()) + tags = tags("leptonica", "") +} diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index ac0a7ed..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,33 +0,0 @@ ---- -version: "3.8" -name: isle-leptonica - -# Common to all services -x-common: &common - restart: "no" - -volumes: - registry-data: {} - -networks: - default: - name: isle-leptonica - -services: - registry: - <<: *common - image: registry:2.8.1 - container_name: isle-leptonica-registry - environment: - REGISTRY_HTTP_ADDR: "0.0.0.0:443" - REGISTRY_STORAGE_DELETE_ENABLED: "true" - REGISTRY_HTTP_TLS_CERTIFICATE: "/usr/local/share/ca-certificates/cert.pem" - REGISTRY_HTTP_TLS_KEY: "/usr/local/share/ca-certificates/privkey.pem" - volumes: - - registry-data:/var/lib/registry - - ./certs/cert.pem:/usr/local/share/ca-certificates/cert.pem:ro - - ./certs/privkey.pem:/usr/local/share/ca-certificates/privkey.pem:ro - - ./certs/rootCA.pem:/usr/local/share/ca-certificates/rootCA.pem:ro - networks: - default: - aliases: [ "islandora.io" ] \ No newline at end of file diff --git a/leptonica/build/APKBUILD b/leptonica/build/APKBUILD index 7921a50..1c615df 100644 --- a/leptonica/build/APKBUILD +++ b/leptonica/build/APKBUILD @@ -1,7 +1,7 @@ # Contributor: Carlo Landmeter # Maintainer: Francesco Colista pkgname=leptonica -pkgver=1.83.1 +pkgver=1.84.1 pkgrel=0 pkgdesc="Software that is broadly useful for image processing and image analysis applications" url="http://www.leptonica.com/" @@ -42,6 +42,6 @@ package() { } sha512sums=" -14c76b8795e494637cd225982cd27a1cd82d22b34c0c0d6ed061530c0ed8cec87fc1c8482bbda8f56a04f240b9fb50d481b8fffe5df846958cb146f9d2d51553 leptonica-1.83.1.tar.gz +949be33a09e1dfc04527f5401d3d682999bd6904dca0b4950b457d12564e3290ec5b62ab4b14ef14d6f499a0fbfa0ebc37c2e8ab2966913883127b9489f47e97 leptonica-1.84.1.tar.gz 37afa0a0b7e0b5ef3ed0bd5106ae221bfb48d966ba02f308076eca4a469d79e69b42d86bdd95563bdc6fe976ed218848160670fa7a261ad6a393e3755962952a disable-one-failing-test.patch " \ No newline at end of file