Gitlab CI for apache project

Recently I have started working on Gitlab and as part of learning I have focused on the Gitlab CI process for my future projects. I have installed gitlab runner with executor as docker. Till here everything is fine. I have got a website which contains HTML pages and I am deploying it in the default apache web server path (/var/www/html). Here is the .gitlab-ci.yml file I am using for the build:

image: centos:7

test:app:
 script:
   - yum install -y httpd git ssh
   - cp -R HTML/* /var/www/html/

Till here the build is getting properly but in order to make the apache up and run the test I am unable to do it. When I add this command in the script, e.g.:

  • docker maven plugin error
  • mount /var/log in docker-compose
  • I can't locate my host directory, which I attached to Docker
  • docker and image size limit
  • Docker client not working under ubuntu 12.04.4
  • Pushing Dockerfile or docker-compose to heroku
  • image: centos:7
    
    test:app:
     script:
       - yum install -y httpd git ssh
       - cp -R HTML/* /var/www/html/
       - sudo apachectl start or /usr/sbin/httpd start
    

    …I am getting an error as “Command not found”.

    How to make the apache instance up and test?

  • Invalid parameter value for redirect_uri: Non-public domains not allowed - Spring social login
  • Docker and Angular app: one or two containers?
  • Failed to start docker.service: Unit docker.service is masked
  • How to upgrade a single program in a container owning several ones?
  • Docker: Error while executing 'docker run hello-world' command
  • Docker 1.12 on Mac issue with DB connection pool
  • One Solution collect form web for “Gitlab CI for apache project”

    Docker containers by default run as root, so there’s no need to sudo and I don’t believe the centos image from the Docker Hub includes the tool.

    When running a process as a container, you don’t launch it via systemd or any of the other init systems, you need to spawn it as a foreground process for docker to attach to. It becomes pid 1, it’s the only process launched (no ssh daemon or other processes you may expect), and when it exits or is killed, the container is stopped. The way to do this with apache according to the repository on Docker Hub where it’s already created is the following Dockerfile entry:

    CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.