Skip to content

Commit

Permalink
Feature/docker image for rc versions and php version as param (#23)
Browse files Browse the repository at this point in the history
* PHP version and Galette version can now be provided as parameters. Galette RC-versions and other pre-releases can now be baked into a Docker image

* Updated the contributing text

* Updated advanced configuration documentation

* updated advanced configuration description

* Updated description and docker-compose files to the new config-folder setup.

* building docker image using dev-versions of galette plugins

* Upgrade to version 1.1.0 and plugin versions 2.1.0
  • Loading branch information
grasdk authored Jun 15, 2024
1 parent aca4862 commit d60fe2b
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 78 deletions.
54 changes: 38 additions & 16 deletions .example/config/behavior.inc.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,42 @@
<?php
//change this *ONLY* for debug purposes!
//define('GALETTE_DISPLAY_ERRORS', true);

/* Per default, Galette will create session with default lifetime duration (and it seems
browsers acts differently in this case). You can anyways define a constant named
GALETTE_TIMEOUT to change session lifetime using behavior configuration:
- see https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-lifetime
*/
//define('GALETTE_TIMEOUT', 0);

/* Uncomment and tune to read user IP addresses from the X-Forwarded-For header
*
* This is for applications sitting behind one or several proxies.
*
* Don't uncomment if the application doesn't sit behind a proxy, as it would
* allow potential attackers to replace their IP addresses with anything,
* increasing a bit their stealth (IP address don't mean that much anyway)
*
* Typically each proxy will append its client's IP address to this header
* The value is used the index of the IP address to consider, from the end
* of the header values, starting with 1.
*
* Hence the provided example is the simplest suitable for being behind
* a single reverse proxy
This is for applications sitting behind one or several proxies.
Don't uncomment if the application doesn't sit behind a proxy, as it would
allow potential attackers to replace their IP addresses with anything,
increasing a bit their stealth (IP address don't mean that much anyway)
Typically each proxy will append its client's IP address to this header
The value is used the index of the IP address to consider, from the end
of the header values, starting with 1.
Hence the provided example is the simplest suitable for being behind
a single reverse proxy
*/
//define('GALETTE_X_FORWARDED_FOR_INDEX', 1);


/* Several modes are provided in Galette you can configure with GALETTE_MODE
constant (see Galette behavior configuration). This directive can take the
following values:
PROD: production mode (non production instance should be on an other mode).
This is the default mode for releases, but it may change in development
branch.
DEMO: demonstration mode, the same as PROD but with some features disabled
like sending emails, modifying superadmin data, ...
TEST: reserved for unit tests.
MAINT: maintainance mode. Only super admin will be able to login.
*/
//define('GALETTE_MODE', 'PROD');

/*change this *ONLY* for debug purposes!
*/
//define('GALETTE_DEBUG', true);
36 changes: 35 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
Building and maintaining this project is solely about the containerization of the finished Galette packages. If you want to contribute to Galette itself, take a look [here](https://galette.eu/site/contribute/).

## Updating to next Galette version
If you just want to upgrade to the next version of Galette, all you need to do is change the version number in the Dockerfile: `ARG galetteversion=<version>`. You might also need to update the plugin versions: `ARG plugin_< plugin name>_version=<version>`.
If you just want to upgrade to the next version of Galette, all you need to do is change the version number in the Dockerfile: `ARG GALETTE_VERSION=<version>`. You might also need to update the plugin versions: `ARG PLUGIN_<plugin name>_VERSION=<version>`.

You can also provide these arguments as a build-args (see [Building the docker image with another version of PHP and/or Galette](#building-the-docker-image-with-another-version-of-php-andor-galette)).

After this, you _should_ of course build and test like described in [Building and testing locally](#building-and-testing-locally). But you can also commit the change, merge it to master and start a new release in GitHub. The github action [build and publish](./.github/workflows/docker-build-and-publish.yml), will build and publish the image, when a new release is published.

Expand Down Expand Up @@ -40,6 +42,38 @@ Although it's possible to build packages without `dockerd` running, using [`buil
* replace `galette-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 with another version of PHP and/or Galette
Follow the instructions above, but add any or both of these build args to the build command: `PHP_VERSION` and/or `GALETTE_VERSION`. For example:

```
docker buildx build --platform linux/amd64 -t galette-local-special \
--build-arg PHP_VERSION=8.2 \
--build-arg GALETTE_VERSION=1.0.4 \
--load .
```

#### Building the docker image with Galette pre-releases
- Follow the instructions above, but override the two build args: `MAIN_PACKAGE_URL` and `GALETTE_RELEASE`. For example:
```
docker buildx build --platform linux/amd64 -t galette-local-prerelease \
--build-arg MAIN_PACKAGE_URL=https://galette.eu/download/dev/ \
--build-arg GALETTE_RELEASE=galette-1.1.0-rc1-20240508-95bbbc2ede \
--load .
```
- If you want to add nightly official plugin releases, follow the instructions above, but add which release you want for each plugin as builds args, e.g. So for eample:
```
docker buildx build --platform linux/amd64 -t galette-local-prerelease \
--build-arg MAIN_PACKAGE_URL=https://galette.eu/download/dev/ \
--build-arg GALETTE_RELEASE=galette-1.1.0-rc1-20240508-95bbbc2ede \
--build-arg PLUGIN_AUTO_VERSION=dev \
--build-arg PLUGIN_EVENTS_VERSION=dev \
--build-arg PLUGIN_FULLCARD_VERSION=dev \
--build-arg PLUGIN_MAPS_VERSION=dev \
--build-arg PLUGIN_OBJECTSLEND_VERSION=dev \
--build-arg PLUGIN_PAYPAL_VERSION=dev \
--load .
```
### 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)
Expand Down
64 changes: 31 additions & 33 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
ARG PHP_VERSION=8.2

# Using PHP-Apache image
FROM php:8.2-apache
FROM php:${PHP_VERSION}-apache
ARG PHP_VERSION
ARG GALETTE_VERSION=1.1.0
ARG GALETTE_RELEASE=galette-${GALETTE_VERSION}

# Maintained by GrasDK for Galette community
LABEL maintainer="GrasDK"
# @author Hiob
# @author GrasDK

LABEL phpversion="8.2"
ARG galetteversion="1.0.4"

## Plugins versions
ARG plugin_auto_version="2.0.0"
ARG plugin_events_version="2.0.0"
ARG plugin_fullcard_version="2.0.0"
ARG plugin_maps_version="2.0.0"
ARG plugin_objectslend_version="2.0.0"
ARG plugin_paypal_version="2.0.0"
ARG PLUGIN_AUTO_VERSION="2.1.0"
ARG PLUGIN_EVENTS_VERSION="2.1.0"
ARG PLUGIN_FULLCARD_VERSION="2.1.0"
ARG PLUGIN_MAPS_VERSION="2.1.0"
ARG PLUGIN_OBJECTSLEND_VERSION="2.1.0"
ARG PLUGIN_PAYPAL_VERSION="2.1.0"

LABEL version=$galetteversion
LABEL description="PHP $phpversion / Apache 2 / Galette $galetteversion"
LABEL description="PHP $PHP_VERSION / Apache 2 / $GALETTE_RELEASE"

LABEL org.opencontainers.image.source=https://github.com/galette-community/docker
LABEL org.opencontainers.image.description="Galette is a membership management web application towards non profit organizations."
LABEL org.opencontainers.image.licenses=GPL-3.0-or-later

ARG main_package_url="https://galette.eu/download/"
ARG plugin_package_url="https://galette.eu/download/plugins/"
#ARG main_package_url="https://download.tuxfamily.org/galette/"
#ARG plugin_package_url="https://download.tuxfamily.org/galette/plugins/"

ARG MAIN_PACKAGE_URL="https://galette.eu/download/"
ARG PLUGIN_PACKAGE_URL="https://galette.eu/download/plugins/"
#ARG MAIN_PACKAGE_URL="https://download.tuxfamily.org/galette/"
#ARG PLUGIN_PACKAGE_URL="https://download.tuxfamily.org/galette/plugins/"
# Install APT dependencies
RUN a2enmod rewrite
RUN apt-get -y update \
Expand Down Expand Up @@ -58,9 +59,6 @@ RUN sed -i "s/galette.localhost/galette.${HOSTNAME}/" /etc/apache2/sites-availab
&& a2dissite -- * && a2ensite vhost.conf

# ENVIRONMENT VARIABLES
## Galette version
ENV GALETTE_VERSION=$galetteversion

## Galette ENV
ENV GALETTE_CONFIG /var/www/galette/config
ENV GALETTE_DATA /var/www/galette/data
Expand All @@ -82,34 +80,34 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Installation Galette and plugins
## Galette
WORKDIR /usr/src
RUN wget --progress=dot:giga ${main_package_url}galette-${GALETTE_VERSION}.tar.bz2
RUN tar jxvf galette-${GALETTE_VERSION}.tar.bz2; mv galette-${GALETTE_VERSION}/galette/* ${GALETTE_INSTALL} ; rm galette-${GALETTE_VERSION}.tar.bz2
RUN wget --progress=dot:giga ${MAIN_PACKAGE_URL}${GALETTE_RELEASE}.tar.bz2
RUN tar jxvf ${GALETTE_RELEASE}.tar.bz2; mv ${GALETTE_RELEASE}/galette/* ${GALETTE_INSTALL} ; rm ${GALETTE_RELEASE}.tar.bz2

## Official plugins
WORKDIR ${GALETTE_INSTALL}/plugins
### Auto
RUN wget --progress=dot:giga ${plugin_package_url}galette-plugin-auto-${plugin_auto_version}.tar.bz2
RUN tar jxvf galette-plugin-auto-${plugin_auto_version}.tar.bz2; rm galette-plugin-auto-${plugin_auto_version}.tar.bz2; mv galette-plugin-auto-${plugin_auto_version} plugin-auto
RUN wget --progress=dot:giga ${PLUGIN_PACKAGE_URL}galette-plugin-auto-${PLUGIN_AUTO_VERSION}.tar.bz2
RUN tar jxvf galette-plugin-auto-${PLUGIN_AUTO_VERSION}.tar.bz2; rm galette-plugin-auto-${PLUGIN_AUTO_VERSION}.tar.bz2; mv galette-plugin-auto-${PLUGIN_AUTO_VERSION} plugin-auto

### Events
RUN wget --progress=dot:giga ${plugin_package_url}galette-plugin-events-${plugin_events_version}.tar.bz2
RUN tar jxvf galette-plugin-events-${plugin_events_version}.tar.bz2; rm galette-plugin-events-${plugin_events_version}.tar.bz2; mv galette-plugin-events-${plugin_events_version} plugin-events
RUN wget --progress=dot:giga ${PLUGIN_PACKAGE_URL}galette-plugin-events-${PLUGIN_EVENTS_VERSION}.tar.bz2
RUN tar jxvf galette-plugin-events-${PLUGIN_EVENTS_VERSION}.tar.bz2; rm galette-plugin-events-${PLUGIN_EVENTS_VERSION}.tar.bz2; mv galette-plugin-events-${PLUGIN_EVENTS_VERSION} plugin-events

### FullCard
RUN wget --progress=dot:giga ${plugin_package_url}galette-plugin-fullcard-${plugin_fullcard_version}.tar.bz2
RUN tar jxvf galette-plugin-fullcard-${plugin_fullcard_version}.tar.bz2; rm galette-plugin-fullcard-${plugin_fullcard_version}.tar.bz2; mv galette-plugin-fullcard-${plugin_fullcard_version} plugin-fullcard
RUN wget --progress=dot:giga ${PLUGIN_PACKAGE_URL}galette-plugin-fullcard-${PLUGIN_FULLCARD_VERSION}.tar.bz2
RUN tar jxvf galette-plugin-fullcard-${PLUGIN_FULLCARD_VERSION}.tar.bz2; rm galette-plugin-fullcard-${PLUGIN_FULLCARD_VERSION}.tar.bz2; mv galette-plugin-fullcard-${PLUGIN_FULLCARD_VERSION} plugin-fullcard

### Maps
RUN wget --progress=dot:giga ${plugin_package_url}galette-plugin-maps-${plugin_maps_version}.tar.bz2
RUN tar jxvf galette-plugin-maps-${plugin_maps_version}.tar.bz2; rm galette-plugin-maps-${plugin_maps_version}.tar.bz2; mv galette-plugin-maps-${plugin_maps_version} plugin-maps
RUN wget --progress=dot:giga ${PLUGIN_PACKAGE_URL}galette-plugin-maps-${PLUGIN_MAPS_VERSION}.tar.bz2
RUN tar jxvf galette-plugin-maps-${PLUGIN_MAPS_VERSION}.tar.bz2; rm galette-plugin-maps-${PLUGIN_MAPS_VERSION}.tar.bz2; mv galette-plugin-maps-${PLUGIN_MAPS_VERSION} plugin-maps

### ObjectsLend
RUN wget --progress=dot:giga ${plugin_package_url}galette-plugin-objectslend-${plugin_objectslend_version}.tar.bz2
RUN tar jxvf galette-plugin-objectslend-${plugin_objectslend_version}.tar.bz2; rm galette-plugin-objectslend-${plugin_objectslend_version}.tar.bz2; mv galette-plugin-objectslend-${plugin_objectslend_version} plugin-objectslend
RUN wget --progress=dot:giga ${PLUGIN_PACKAGE_URL}galette-plugin-objectslend-${PLUGIN_OBJECTSLEND_VERSION}.tar.bz2
RUN tar jxvf galette-plugin-objectslend-${PLUGIN_OBJECTSLEND_VERSION}.tar.bz2; rm galette-plugin-objectslend-${PLUGIN_OBJECTSLEND_VERSION}.tar.bz2; mv galette-plugin-objectslend-${PLUGIN_OBJECTSLEND_VERSION} plugin-objectslend

### Paypal
RUN wget --progress=dot:giga ${plugin_package_url}galette-plugin-paypal-${plugin_paypal_version}.tar.bz2
RUN tar jxvf galette-plugin-paypal-${plugin_paypal_version}.tar.bz2; rm galette-plugin-paypal-${plugin_paypal_version}.tar.bz2; mv galette-plugin-paypal-${plugin_paypal_version} plugin-paypal
RUN wget --progress=dot:giga ${PLUGIN_PACKAGE_URL}galette-plugin-paypal-${PLUGIN_PAYPAL_VERSION}.tar.bz2
RUN tar jxvf galette-plugin-paypal-${PLUGIN_PAYPAL_VERSION}.tar.bz2; rm galette-plugin-paypal-${PLUGIN_PAYPAL_VERSION}.tar.bz2; mv galette-plugin-paypal-${PLUGIN_PAYPAL_VERSION} plugin-paypal

# CRON Auto-Reminder
## Copy galette-cron file to the cron.d directory
Expand Down
Loading

0 comments on commit d60fe2b

Please sign in to comment.