Skip to content

Creating patch guide

ZCube edited this page Jan 21, 2023 · 4 revisions

Basic guide

Basically, creating a compatible image is reverse engineering. It's not easy to find another guide. Components written in the same language are good references.

First of all, below is how I use it.

  1. First, find the list of components you need.

https://github.com/bitnami/containers/blob/main/bitnami/matomo/4/debian-11/prebuildfs/opt/bitnami/.bitnami_components.json

  1. Find a list of components that need to be worked on.
go run main.go list --app=matomo
* [ ] matomo:4.13.1
  ❌  matomo.4.13.1-1

You only need one matomo component.

  1. Identify the required language
  1. Check bitnami docker image.
docker run --rm -ti bitnami/matomo /bin/bash -c "ls -al /opt/bitnami"
docker run --rm -ti bitnami/matomo /bin/bash -c "find /opt/bitnami/matomo"
  • Basically, you need to prepare all executable files in /opt/bitnami/{{component}/bin
  • Other files in /opt/bitnami/{{component} also need to be prepared in some cases, refer to the component related guide.
  1. References other components that use the same language.
  • wordpress

cat patches/wordpress/6/docker/Dockerfile.from

# Dockerfile.from = One stage in a multistage build of a Dockerfile.
FROM alpine:3.12.0 as wordpress

COPY --from=bitnami/wordpress:{{{VERSION}}} /opt/bitnami/wordpress/ /opt/bitnami/wordpress/
COPY --from=bitnami/wordpress:{{{VERSION}}} /opt/bitnami/wp-cli/ /opt/bitnami/wp-cli/

cat patches/wordpress/6/docker/Dockerfile.install

# Dockerfile.install = Dockerfile content to be embedded in main stage
COPY --from=wordpress /opt/bitnami/ /opt/bitnami/
  1. Create a component patch based on the patch found in step 4.
go run main.go makeDirs --app=matomo

# Dockerfile.from = One stage in a multistage build of a Dockerfile.
vi patches/matomo/4/docker/Dockerfile.from
... something
# Dockerfile.install = Dockerfile content to be embedded in main stage
vi patches/matomo/4/docker/Dockerfile.install
... something
  1. Testing. 6 on failure
go run main.go generate --app=matomo
go run main.go build --app=matomo
  1. Complete

I hope this guide is helpful.


Samples by language

Clone this wiki locally