Docker-Images for Deployment with Gitlab-Runners
This page shows and explains a simple setup for a Docker image to be used for deployment of Shopware 6.6 and above.
My goal was to create a minimalist yet secure Docker container to use in my Shopware 6 deployments.
I used to start with php-cli images as a base for my setup. However, the resulting image was over 1 GB in size. The approach described here was inspired by https://shyim.me/blog/wolfi-os-for-php/. You can find more information about the wolfi base image here: https://github.com/wolfi-dev/. Not only is the resulting image much smaller, it is also easier to set up (due to the apk manager used) and can be considered one of the most secure base images for Docker setups.
This is the Dockerfile I ended up with:
The imported php ini file simply raises the execution time and memory limit to whatever the server allows.
The resulting image is only 265 MB in size. The deployment time for a vanilla Shopware 6.6 installation is less than 2.5 minutes.
I use this image on a Hetzner cloud server and have found a CX31 (2 Intel CPUs, 8GB RAM) to be quite sufficient for the job. Note that some Hetzner cloud server IP4 addresses may be inadvertently blacklisted by gitlab.com, causing problems when the runner tries to pull from the repository. In these cases, take a snapshot of your runner and spin up a new server, hoping to grab a "clean" unlisted IP4.
Last updated