Skip to content

Commit

Permalink
fix dockerfiles + add corresponding doc (#946)
Browse files Browse the repository at this point in the history
- convert packaging README in md and document docker build
- add doc for docker custom command line args
- fix Dockerfile volumes declaration
- add doc for building ssp-alpine image
  • Loading branch information
David Coutadeur authored and davidcoutadeur committed Jul 24, 2024
1 parent de77852 commit 5db7c7f
Show file tree
Hide file tree
Showing 5 changed files with 151 additions and 96 deletions.
11 changes: 11 additions & 0 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,17 @@ Start container, mounting that configuration file:
-v $PWD/ssp.conf.php:/var/www/conf/config.inc.local.php \
-it docker.io/ltbproject/self-service-password:latest

You can also add options that will be passed to the command line:

.. prompt:: bash #

docker run -p 80:80 \
-v $PWD/ssp.conf.php:/var/www/conf/config.inc.local.php \
-it docker.io/ltbproject/self-service-password:latest
-e debug

Here, `-e debug` will be passed to the apache server


From git repository, for developpers only
-----------------------------------------
Expand Down
86 changes: 0 additions & 86 deletions packaging/README

This file was deleted.

137 changes: 137 additions & 0 deletions packaging/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# Some notes on packaging Self Service Password

## 0 - Version update

Update version in following files:

* htdocs/index.php
* packaging/rpm/SPECS/self-service-password.spec
* packaging/debian/changelog

## 1 - Update dependencies and run tests

From the self-service-password root directory, run:

```
composer update
```

Run tests:

```
XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text --configuration tests/phpunit.xml
```

After the tests, remove the useless dependencies:

```
composer update --no-dev
```


## 2 - Archive tar.gz

From current directory, do:
```
./makedist VERSION
```

with VERSION the current verion of the package

For example:
```
./makedist 0.4
```


## 3 - Debian

Form current directory, do:

```
dpkg-buildpackage -b -kLTB
```

If you do not have LTB GPG secret key, do:

```
dpkg-buildpackage -b -us -uc
```

## 4 - RPM (RHEL, CentOS, Fedora,...)

Prepare your build environment, for example in /home/clement/build.

You should have a ~/.rpmmacros like this:

```
%_topdir /home/clement/build
%dist .el5
%distribution .el5
%_signature gpg
%_gpg_name 6D45BFC5
%_gpgbin /usr/bin/gpg
%packager Clement OUDOT <[email protected]>
%vendor LTB-project
```

Copy packaging files from current directory to build directory:

```
cp -Ra rpm/* /home/clement/build
```

Copy Self Service Archive to SOURCES/:

```
cp ltb-project-self-service-password-VERSION.tar.gz /home/clement/build/SOURCES
```

Go in build directory and build package:

```
cd /home/clement/build
rpmbuild -ba SPECS/self-service-password.spec
```

Sign RPM:

```
rpm --addsign RPMS/noarch/self-service-password*
```

## 5 - Docker

Pre-requisites:

* docker / podman
* if docker: a version with buildkit (included by default in Docker Engine
as of version 23.0, but can be enabled in previous versions with
DOCKER_BUILDKIT=1 in build command line)

From "packaging" directory, do:

```
DOCKER_BUILDKIT=1 docker build -t self-service-password -f ./docker/Dockerfile ../
```

For Alpine linux image :

```
DOCKER_BUILDKIT=1 docker build -t self-service-password-alpine -f ./docker/Dockerfile.alpine ../
```


You can also build with podman:

```
podman build --no-cache -t self-service-password -f ./docker/Dockerfile ../
```

Tag the `latest` image with the major and minor version, for example:

```
docker tag self-service-password:latest ltbproject/self-service-password:1.4.4
docker tag self-service-password:latest ltbproject/self-service-password:1.4
docker tag self-service-password:latest ltbproject/self-service-password:latest
```
6 changes: 1 addition & 5 deletions packaging/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,7 @@ COPY --from=build /rootfs /

WORKDIR /var/www/htdocs

VOLUME [ \
"/var/www/templates_c" , \
"/var/www/conf" , \
"/var/www/cache" , \
]
VOLUME [ "/var/www/templates_c", "/var/www/conf", "/var/www/cache" ]

EXPOSE 80

Expand Down
7 changes: 2 additions & 5 deletions packaging/docker/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ ARG COMPOSER_IMAGE

COPY --from=composer /composer /usr/bin/composer

ADD $SMARTY_URL ./
RUN set -ex; \
\
SMARTY_DIR=/usr/share/php/smarty${SMARTY_VERSION%%.*}; \
Expand Down Expand Up @@ -272,11 +273,7 @@ COPY --from=build /rootfs /

WORKDIR /var/www/htdocs

VOLUME [ \
"/var/www/templates_c" , \
"/var/www/conf" , \
"/var/www/cache" , \
]
VOLUME [ "/var/www/templates_c", "/var/www/conf", "/var/www/cache" ]

EXPOSE 80

Expand Down

0 comments on commit 5db7c7f

Please sign in to comment.