This guide shows how to quickly set up CI/CD in GitLab — from creating a project and a test branch to registering a GitLab Runner and automatically deploying WordPress. This approach simplifies the development process and speeds up code updates on the server.
To create a project in GitLab:
Go to “New Project” > “Create blank Project.”


Fill in all the required information to create your new project.

Once the repository is created, you need to create a test branch to add the WordPress files.

Click the + icon and select “New Branch.”

Name the branch wp-test (as an example — you can choose any name) and click “Create branch.”

After that, switch to this branch:

Go to your test branch and add the file
.gitlab-ci.yml
Then create a Docker/ directory and add the following files inside it:
wp-traefik.prod.yml and .env
Example:
.gitlab-ci.yml

Example: wp-traefik.prod.yml

Example: .env

Now go to your production server to create a GitLab Runner, which will be used to upload your code to the target server.
On the production server, add the Docker image for the GitLab Runner:
docker run -d --name gitlab-runner --restart always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /gitlab-runner/config:/etc/gitlab-runner \
gitlab/gitlab-runner:latest

Also, create a network on the production server:
docker network create web
To register the GitLab Runner, you need to obtain a token.
To do this, go to the following path:
GitLab → Settings > CI/CD > Runners > Create project runner

After that, start the registration of the GitLab Runner.
docker exec -it gitlab-runner gitlab-runner register
Enter the following information:
URL: https://gitlab.example.net
Token: <token> obtained from GitLab
Description: prod-runner
Executor: docker
Default image: php:8.2-apache
Verify the registration by running:
docker exec -it gitlab-runner gitlab-runner verify
The output should be:
Verifying runner… is valid
Once our runner has passed validation and successfully connected to GitLab, proceed to merge the test branch with main — click “Create merge request.”

After that, the tests and code deployment to the production server will start. Once the process is complete, you’ll have a fully functional WordPress website.

Conclusion
By following all the steps, you have set up a fully functional CI/CD pipeline in GitLab for your project.
The created pipeline automatically builds and deploys the application with every change in the repository, while the GitLab Runner executes tasks without manual intervention.
This approach speeds up development, reduces the risk of errors, and ensures stable code deployment to the server.
You can now expand your pipeline configuration by adding testing, security checks, or automatic Docker container updates — depending on your project’s needs.