From 16e2966bcdf94848fae1863a2b7995c9d51bd5f5 Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 12 Oct 2025 10:31:56 +0200 Subject: [PATCH 1/2] Added develop to automatic build and publish --- .github/workflows/docker-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 9962812..b0843f1 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -6,7 +6,7 @@ on: - cron: '0 0 * * *' # Triggers the workflow on push events but only for the main branch push: - branches: [main] + branches: [main, develop] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: From 7eebfe3262ae7863e91de0076cb37ed878ea70ab Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 13 Oct 2025 00:41:33 +0200 Subject: [PATCH 2/2] Dockerfile fix, Added CONTRIBUTING. Added more details to README and provided more examples dependent on docker-compose-v2. Added separate scheduling for different builds. --- .github/workflows/docker-publish.yml | 11 ++- CONTRIBUTING.md | 45 ++++++++++ Dockerfile | 3 +- README.md | 115 ++++++++++++------------- sample/docker-compose-sqlite-dbvol.yml | 18 ++++ sample/docker-compose-sqlite.yml | 17 ++++ sample/docker-compose.yml.sample | 6 +- 7 files changed, 149 insertions(+), 66 deletions(-) create mode 100644 CONTRIBUTING.md create mode 100644 sample/docker-compose-sqlite-dbvol.yml create mode 100644 sample/docker-compose-sqlite.yml diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index b0843f1..75e5eed 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -2,11 +2,13 @@ name: Publish Docker image on: # Schedule daily at 12am - schedule: - - cron: '0 0 * * *' + schedule: + - cron: '0 0 * * *' # nightly develop + - cron: '0 0 * * 0' # weekly release-candidate (Sundays) + - cron: '0 0 1 * *' # monthly stable (1st of each month) # Triggers the workflow on push events but only for the main branch push: - branches: [main, develop] + branches: [main] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -46,6 +48,7 @@ jobs: ghcr.io/${{ github.repository }} - name: STABLE - Build and push Docker images + if: github.event.schedule == '0 0 1 * *' || github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' uses: docker/build-push-action@v5 with: context: . @@ -59,6 +62,7 @@ jobs: cache-to: type=gha,scope=stable,mode=max - name: DEVELOP - Build and push Docker images + if: github.event.schedule == '0 0 * * *' || github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' uses: docker/build-push-action@v5 with: context: . @@ -72,6 +76,7 @@ jobs: cache-to: type=gha,scope=develop,mode=max - name: RELEASE-CANDIDATE - Build and push Docker images + if: github.event.schedule == '0 0 * * 0' || github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' uses: docker/build-push-action@v5 with: context: . diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..3baf5c0 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,45 @@ +# wish**this** Docker project +Building and maintaining this project is solely about the containerization of [wish**this**](https://github.com/wishthis/wishthis/). If you want to contribute to wishthis itself, take a look [here](https://github.com/wishthis/wishthis/?tab=readme-ov-file#trophy-contributing). + +## Building and testing locally + +If you contribute to this image, before making a pull request, you should build and run it locally. Here is a guide on how to do this. + +### Prerequisites + +- `docker` is installed in your development environment. +- `dockerd` the docker deamon is installed (and [started](https://docs.docker.com/config/daemon/start/)) +- `buildx` is installed in your development environment. + +Although it's possible to build packages without `dockerd` running, using [`buildah`](https://buildah.io/), the focus here is on [`buildx`](https://docs.docker.com/reference/cli/docker/buildx/). You're welcome to contribute with instructions for `buildah`. + +### Building the docker image locally + +1. Start the docker daemon if it's not already started: `sudo dockerd` +2. Run the build command: + ``` + docker buildx build --platform linux/amd64 -t wishthis-local --load . + ``` + + * replace the platform (`linux/amd64`) if you're building on another platform + * replace `wishthis-local` with any name you would like to give your local image + * `--load .` loads the image into your local docker, so you can use it as a container image. + +#### Building the docker image containing the _non-release_ versions wish**this** +- Follow the instructions above, but override the build arg: `WISHTHIS_GITBRANCH`. For example, you can build the _develop_ version: + ``` + docker buildx build --platform linux/amd64 -t wishthis-local-dev \ + --build-arg WISHTHIS_GITBRANCH=develop --load . + ``` + + This approach may also be used for other [branches of wish**this**](https://github.com/wishthis/wishthis/branches), including the [release-candidate](https://github.com/wishthis/wishthis/tree/release-candidate). Simply replace _develop_ in the above command with the proper branch name. + +### Building for multiple architecures locally +1. Start the docker daemon if it's not already started: `sudo dockerd` +2. Create a builder-image `docker buildx create --name mybuilder --use --bootstrap` (see "Building with Buildx" [here](https://www.docker.com/blog/how-to-rapidly-build-multi-architecture-images-with-buildx/) for more details) +3. Run the build command: `docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t wishthis-local .` + * replace `wishthis-local` with any name you would like to give your local image + * NOTE: The build process is significantly longer than just building for your local architecture. + +### Running the docker image locally +1. Follow the same steps as in [Docker : usage](./README.md#Docker-:-usage), replacing the image name `hiob/wishthis:stable` with your local container name, e.g. `wishthis-local`. \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 2902ffc..4a1c331 100644 --- a/Dockerfile +++ b/Dockerfile @@ -49,6 +49,8 @@ RUN chmod +x /usr/local/bin/entrypoint.sh # Final image build FROM php:8.2-apache-bullseye +ARG WISHTHIS_GITBRANCH +ENV WISHTHIS_GITBRANCH=$WISHTHIS_GITBRANCH # Metadata LABEL maintainer="hiob <50a7f360-a150-43e4-8aa0-5e837f6c061c@corbeille.xyz>" @@ -103,4 +105,3 @@ USER www-data # Entrypoint and default command ENTRYPOINT ["sh", "/usr/local/bin/entrypoint.sh"] CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"] - diff --git a/README.md b/README.md index e8c19de..6a82bfd 100644 --- a/README.md +++ b/README.md @@ -1,69 +1,68 @@ -![wishthis logo](https://raw.githubusercontent.com/wishthis/wishthis/develop/src/assets/img/logo-readme.svg "wishthis logo") +![wish**this** logo](https://raw.githubusercontent.com/wishthis/wishthis/develop/src/assets/img/logo-readme.svg "wish**this** logo") -# wishthis - [Official docker image](https://hub.docker.com/r/hiob/wishthis) -[wishthis](https://wishthis.online/) is a simple, intuitive and modern wishlist platform to create, manage and view your wishes for any kind of occasion. +# wish**this** - [Official docker image](https://hub.docker.com/r/hiob/wishthis) +[wish**this**](https://wishthis.online/) is a simple, intuitive and modern wishlist platform to create, manage and view your wishes for any kind of occasion. -## wishthis : documentation and setup -Always refer you to [wishthis documentation](https://github.com/wishthis/wishthis/). +## wish**this** : documentation and setup +Always refer you to [wish**this** documentation](https://github.com/wishthis/wishthis/). ## Docker : usage You can find support and an updated documentation on our [Github's repository](https://github.com/wishthis/docker/). -We host ours docker images on [Docker's hub](https://hub.docker.com/r/hiob/wishthis) or [ghcr.io](https://ghcr.io/wishthis/docker) - -Three tags/images are avalaibles: -- **develop** : for Wishthis's [*develop branch*](https://github.com/wishthis/wishthis/tree/develop) -- **release-candidate** : for Wishthis's [*release-candidate branch*](https://github.com/wishthis/wishthis/tree/release-candidate) **RECOMMENDED** -- **stable** : for Wishthis's [*stable branch*](https://github.com/wishthis/wishthis/tree/stable) - -### Docker-compose -Always refer you to [Docker compose documentation](https://docs.docker.com/compose/reference/). - -Here a sample of [docker-compose.yml](sample/docker-compose.yml.sample). MySQL server isn't included in image, you should set it in another container : - - -``` -version: '3.7' - -services: - wishthis: - container_name: wishthis - restart: unless-stopped - image: hiob/wishthis:stable - environment: - - VIRTUAL_HOST=sub.domain.ext - ports: - - 80:80 - volumes: - - ./config.php:/var/www/html/src/config/config.php - networks: - - wishthis - - mariadb: - container_name: db - restart: unless-stopped - image: mariadb - environment: - MARIADB_ROOT_PASSWORD: rootpassword - MARIADB_DATABASE: databasename - MARIADB_USER: username - MARIADB_PASSWORD: userpassword - volumes: - - ./data:/var/lib/mysql - ports: - - 3306:3306 - networks: - - wishthis - -networks: - wishthis: - external: true -``` +We host our docker images on [Docker's hub](https://hub.docker.com/r/hiob/wishthis) or [ghcr.io](https://ghcr.io/wishthis/docker) + +Three tags/images are avalaible: +- **develop** : for Wish**this**'s [*develop branch*](https://github.com/wishthis/wishthis/tree/develop) +- **release-candidate** : for Wish**this**'s [*release-candidate branch*](https://github.com/wishthis/wishthis/tree/release-candidate) **RECOMMENDED** +- **stable** : for Wish**this**'s [*stable branch*](https://github.com/wishthis/wishthis/tree/stable) + +### Docker-compose : wish**this** with MariaDB +Install docker-compose version 2. Example with apt: `sudo apt install docker-compose-v2`. Always refer to the [Docker compose documentation](https://docs.docker.com/compose/reference/). + +Here a sample of [docker-compose.yml.sample](sample/docker-compose.yml.sample). MySQL/MariaDB server isn't included in image, you should set it in another container, this is done in the linked docker-compose sample. + +1. Copy the [docker-compose.yml](sample/docker-compose.yml.sample) to a folder on your docker host, name it `docker-compose.yml`. +2. Edit the file and configure your MySQL compatible MariaDB's connection settings, by altering the values of `MARIADB_ROOT_PASSWORD`, `MARIADB_DATABASE`, `MARIADB_USER` and `MARIADB_PASSWORD`. +3. Copy [config-sample.php](https://github.com/wishthis/wishthis/blob/develop/src/config/config-sample.php) into a file called `config-sample.php` in the same folder as `docker-compose.yml` +4. Run `docker-compose up -d` Wishthis will be available to http://localhost:80. +5. Follow the installation guide. Select MySQL and enter the values from the MariaDB configuration in your `docker-compose.yml`. + You can use a reverse proxy ([Nginx](https://www.nginx.com/),[ Traefik](https://doc.traefik.io/traefik/getting-started/quick-start/), [SWAG](https://docs.linuxserver.io/general/swag)...) to serve wishthis with is own (sub)domain name. -### Permanent configuration -At first launch, if you didn't create a Wishthis's configuration file by mounting a permanent volume, You will be invite to setup Wishthis and database. +### Docker-compose : wish**this** with SQLite +Install docker-compose version 2. +1. Copy the [docker-compose-sqlite.yml](sample/docker-compose-sqlite.yml) to a folder on your docker host, name it `docker-compose.yml`. +2. Copy [config-sample.php](https://github.com/wishthis/wishthis/blob/develop/src/config/config-sample.php) into a file called `config-sample.php` in the same folder as `docker-compose.yml` +3. Run `docker-compose up -d` + +Wishthis will be available to http://localhost:80. + +> **NOTE**: The SQLite database will reside inside the container in `/var/www/html/database.sqlite`. To make your database persistent between containers, you should extract the file to your docker host and then mount it as a volume. (see [docker-compose.yml example](sample/docker-compose-sqlite-dbvol.yml)). This extra step can be eliminated when [this issue](https://github.com/wishthis/wishthis/issues/232) has been resolved. + +### Docker CLI : wish**this** with SQLite + +1. Copy [config-sample.php](https://github.com/wishthis/wishthis/blob/develop/src/config/config-sample.php) into a file called `config-sample.php` in the same folder as `docker-compose.yml` +2. Run + ``` + docker run -d \ + --name wishthis \ + --restart unless-stopped \ + -e VIRTUAL_HOST=sub.domain.ext \ + -p 80:80 \ + -v "$(pwd)/config/:/var/www/html/src/config/" \ + hiob/wishthis:develop + ``` -To keep your database configuration permanent, mount a volume (see example above), create a file named `config.php` and copy the [`config-sample.php` from Github's repo](https://github.com/wishthis/wishthis/blob/develop/src/config/config-sample.php). +> **NOTE**: The SQLite database will reside inside the container in `/var/www/html/database.sqlite`. To make your database persistent between containers, you should extract the file to your docker host and then mount it as a volume. This extra step can be eliminated when [this issue](https://github.com/wishthis/wishthis/issues/232) has been resolved. To mount this extra file with the docker CLI also, the full command will be: + ``` + docker run -d \ + --name wishthis \ + --restart unless-stopped \ + -e VIRTUAL_HOST=sub.domain.ext \ + -p 80:80 \ + -v "$(pwd)/config/:/var/www/html/src/config/" \ + -v "$(pwd)/database.sqlite:/var/www/htmldatabase.sqlite" \ + hiob/wishthis:develop + ``` \ No newline at end of file diff --git a/sample/docker-compose-sqlite-dbvol.yml b/sample/docker-compose-sqlite-dbvol.yml new file mode 100644 index 0000000..5017ef8 --- /dev/null +++ b/sample/docker-compose-sqlite-dbvol.yml @@ -0,0 +1,18 @@ +services: + wishthis: + container_name: wishthis + restart: unless-stopped + image: hiob/wishthis:stable + environment: + - VIRTUAL_HOST=sub.domain.ext + ports: + - 80:80 + volumes: + - ./config/:/var/www/html/src/config/ + - ./database.sqlite;/var/www/html/database.sqlite + networks: + - wishthis + +networks: + wishthis: + external: false diff --git a/sample/docker-compose-sqlite.yml b/sample/docker-compose-sqlite.yml new file mode 100644 index 0000000..16e9ea9 --- /dev/null +++ b/sample/docker-compose-sqlite.yml @@ -0,0 +1,17 @@ +services: + wishthis: + container_name: wishthis + restart: unless-stopped + image: hiob/wishthis:stable + environment: + - VIRTUAL_HOST=sub.domain.ext + ports: + - 80:80 + volumes: + - ./config/:/var/www/html/src/config/ + networks: + - wishthis + +networks: + wishthis: + external: false diff --git a/sample/docker-compose.yml.sample b/sample/docker-compose.yml.sample index a0fb0c1..385b080 100644 --- a/sample/docker-compose.yml.sample +++ b/sample/docker-compose.yml.sample @@ -1,5 +1,3 @@ -version: '3.7' - services: wishthis: container_name: wishthis @@ -10,7 +8,7 @@ services: ports: - 80:80 volumes: - - ./config.php:/var/www/html/src/config/config.php + - ./config/:/var/www/html/src/config/ networks: - wishthis @@ -32,4 +30,4 @@ services: networks: wishthis: - external: true + external: false