Category: docker

Two tips to speed up bitbucket pipelines

In the past few days, I was playing around with pipelines to see what can I do with it, and how much can I squeeze it to get as much as I can from the functionality they offer. And I wanted to point out to two main things that you can do to speed up your PHP testing a bit, not much but a bit which counts.

First of all, if you don’t use the built-in composer cache functionality, then you need to do that right away, and enabling it is just a small line of code that you add to the test section like

Nothing else, once you have done that you will use the cache they offer and no need to redownload the packages from the internet and the cache will be invalidated automatically after 7 days (if am not mistaken), but this does not mean you don’t have the ability to delete the cache manually. But keep in your mind that each section should use the caches tag otherwise it won’t be useful, sadly Bitbucket pipeline does not offer a global cache feature.

Secondly, remember to install and use hirak/prestissimo package globally, which will give you a nice speed as we all know.

so your file can have something like:


Filed under: Code, docker, PHP

Running Laravel Dusk tests on Bitbucket, the easy way

So today I was trying to run and see if I can manage to get Laravel dusk to run on Bitbucket pipelines, and after too many tests, I was able to do so \(^ ^)/.

In this post I’ll explain the minimum requirements you need to do that, to make things simple, I created a docker image based on PHP 7.2 that you can use directly.

Configure your Laravel project:

After installing Laravel and Laravel dusk (you can read all about it on the docs), you can create a new environment file called .env.dusk which contain the following:

Continue reading

Filed under: Code, docker, Laravel, Linux, PHP

[snippet] Running Traefik with Docker Swarm

The other day, I wanted to try using Traefik in real world scenario where I’ll have a docker instance running and Traefik will do the routing/proxying based on the domain name that I will provide, sadly this was not so easy, so after few hours of searching I found the solution.

You may ask, why it didnt work, it should work with no problem, and I agree so am going to list the problem I faced and the solution I found. To work with swarm, I created three servers and joined them in one swarm network, where I had one manager and two workers, then I used this simple docker-compose.yml file to create the app

Continue reading

Filed under: Code, docker, Linux

Run crontab within Alpinelinux Docker image

This post will explain how we can run cronjobs within Docker image based on Alpine Linux distribution, so am going to use my newest PHP 7.2 docker image, which you can find at zaherg/php-7.2-xdebug-alpine .

First, we will have to pull the docker image using the command:

Now that we have downloaded the image, we will have to familiarize our self with the structure for the periodic directory which we can find under /etc/periodic, this directory should contain the following folders:

  1. 15min
  2. hourly
  3. daily
  4. weekly
  5. monthly

Continue reading

Filed under: Code, docker, Linux

Using Minio server for simulate S3 locally

The other day, I was building a small development environment for me to test Laravel and S3, but as usual, I didn’t want to use production credentials nor to use S3 directly, so after a small search I found Minio :

Minio is an open source object storage server with Amazon S3 compatible API. 
Build cloud-native applications portable across all major public and private clouds.

And I was so happy, as I’ll be able to use S3 locally and wont worry about hitting outside my local network, I pulled the docker image, and then I realize that I’ll have to specify the command to run and some environment variables which okay for local development, but it wont work with Bitbucket Pipelines, so my tests wont work.

you can read this tweet and the list of tweets under it

So what I did was to build a new docker image that will have everything up and running, the content of the Dockerfile was

which is simple and nice, but again wont be that much helpful, as I need to have two default buckets created automatically for me, so I altered the file to create a new directories under the /data directory.

Continue reading

Filed under: Code, docker