Hy There,
I have a favor to ask and tell me guys what am I doing wrong with GitLab CI. Firstly the environment.
WebDevelopement is here, so JavaScript, PHP, CSS, HTML, etc. I have a Gitlab server where I wish to run my docker builds. The goal is to use a webserver docker and inside the docker it sets up a database and the whole website and tests it. All done, everything works like a charm. However after a month the server refuses to build any projects. Turn out on the server I had tonns of docker containers. After I remove them all, the server is back again working.
My question is basically: what should I do?
I though of 2 sollutions
- Create a sudo crontab to remove the containers every week
- Can’t I tell GitLab to build the container and after the build have succeeded delete it?
Here is my gitlab-ci.yml file for you, so you can see if I’ve made an error:
stages:
- test
- dev
- prod
variables:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: homestead
MYSQL_PASSWORD: secret
MYSQL_DATABASE: homestead
services:
- mysql:latest
php:5.6:
stage: test
image: bobey/docker-gitlab-ci-runner-php5.6
script:
- composer self-update
- composer install --no-scripts
- php artisan clear-compiled
- php artisan optimize
- cp .env.gitlab .env
- php artisan key:generate
- composer dump-auto
- php artisan migrate:refresh --seed
- echo “Running PHPUnit Tests”
- php vendor/bin/phpunit --colors --debug
developement:
stage: dev
when: on_success
only:
- dev
except:- /^issue-.*$/
script:- curl http://here/is/my/staging/website.php
production:
stage: prod
when: on_success
only:
- master
except:- /^issue-.*$/
script:- curl http://here/is/my/production/website.php
In the staging and production stages I just wish to use the last command so, to curl a specific php file on the servers. However this simple job takes about 1 minute to complete. Why? How can I reduce the time for it?
Thank you in advance!