Categories
Docker Kubernetes

Composer Updates in Docker Images

I recently started to use composer-packaged applications within Docker images. But I noticed that the Docker image did not change when I rebuilt after I updated one of the module dependencies. The reason is the caching mechanism of docker builds. A very obvious solution would be the --no-cache option when building. But this is a bad solution as it would cause the complete build to make use of the cache.

Another solution I found was using ARGs that will disable the cache for a command. I personally felt this not very helpful as it would involve some awkward tweak of the build process (as I understand). So I discovered a very simple solution: the ADD command can skip the caching when using a web URL as the content to download. The command would download the content from the address and compare it to the previous cache content. We would just need a URL that returns a different content each time it is called. And luckily there is one.

So the elegant solution is to use this combination of lines in your Dockerfile and the composer modules are updated accordingly each time:

# The RUN must use cached layers, this is the hack
ADD "https://www.random.org/cgi-bin/randbyte?nbytes=10&format=h" skipcache
RUN composer install \
    && chown -R www-data:www-data /var/www/html
Categories
Bugzilla for Java CSV Compiling Templating

CSV, B4J and Templating become integrated with Maven

Some improvements are coming along. I was asked several times whether my Java projects could be based on Maven build so they can be more easily integrated with other projects. Now it’s coming around the corner. CSV/Excel Utility Package is almost complete and you can already see the results in the Nightly Build. The release is not far away, just a few more tests are remaining.

The Maven coordinates you would require are:

<dependency>
  <groupid>eu.ralph-schuster</groupid>
  <artifactid>csv</artifactid>
  <version>2.3</version>
</dependency>
 
<dependency>
  <groupid>eu.ralph-schuster</groupid>
  <artifactid>b4j</artifactid>
  <version>1.1</version>
</dependency>
 
<dependency>
  <groupid>eu.ralph-schuster</groupid>
  <artifactid>templating</artifactid>
  <version>1.1</version>
</dependency>

Please notice that none of these artifacts are yet released. Earlier releases will propably not become available via public repositories. But this isn’t decided yet.

By the way: The artifacts will be publicly available to you without any further Maven configuration as I will publish them to Sonatype’s official OSS repository which is part of Maven’s default repository list.