At the end of this how-to this setup will do the following for you:

If you create a new branch (any feature branch or just "dev") a new container will be build and pushed to the internal registry. A new project in will be started with a domain reflecting the branch ( which you can send to your customer or QA department. If everything is fine you can merge the change and it will go live automatically or after one click (if this feels safer for you). The feature branch and the application will be deleted. You can start with the next feature.

You can do this with your own GitLab instance when it is ready configured for docker and Auto DevOps (which is normally the case).

  1. On the projects overview page click "Create a project".

At this point you can follow the how-to step by step which includes creating files (Dockerfile etc.) or you can import the ready to use files from

If you choose to import the files use "Import project" and "Repo by URL" with as the URL. To start the import, click "Create Project" and jump to step 4:

2. If you want to go step by step start with "Blank project" and give your project a name.

3. Let's create a HTML project by adding a HTML file.

Name the file index.html  and add the following code.

    <title>Sample "Hello, World" Application</title>
    <p>" - Agile" is awesome!</p>

Commit your changes and add a Dockerfile (Overview=>Details) which will build the image.

FROM nginx
COPY index.html /usr/share/nginx/html

and our deployment file called sloppy.yml 

version: "v1"
project: "$project"
       image: $image
       domain: "$domain"
       ports: 80

And now the .gitlab-ci.yml  so we have the following file structure:

This might already trigger a failing build, which you can ignore.

4. Next add 3 “Secret variables” (Settings => CI/CD =>Variables):

AUTO_DEVOPS_DOMAIN: Add a wildcard domain. If you don't have a custom wildcard domain you can go with here.

SLOPPY_APITOKEN : On generate a new token and copy it, without the “export” command! Just the part starting with ey...
SLOPPY_APP_PATH : The app id (see sloppy.yml). For example if this repo contains the code for the app named web  inside the service frontend  it is:
SLOPPY_PROJECTNAME : The name of your project in Keep in mind that at the end of this how-to a deployment will start and overwrite the project you named here so it is maybe safer to not use a name of an already running live project!

Before we configure Auto DevOps and start our first deployment we need to upload the docker registry credentials to the platform.

 If we don't, can not pull the image from our private docker registry. 

Every GitLab project comes with it's own docker registry. Go to Registry to find the information how to login into it which is basically:

docker login 

followed by the same login credentials you use to login to GitLab.

After you have logged in on your terminal, use the CLI to upload the credentials for this registry to

sloppy docker-login 

Note: To make the registry public you need to do so for the repository, which means your code is public. If this is fine for you go to Settings=>General=>Permissions and set the Project Visibility to public.

5. Now we can use GitLabs Auto DevOps feature to automate all the things. Enable AutoDevops (Settings => CI/CD => Auto DevOps).

Now, change something in index.html. Every commit will trigger a deploment. Check it in detail by clicking "running" in CI/CD

and then a running pipeline for example build

When the build is done it will go to the next stept until everything is finished.

The following happened here:

  1. A docker build was run with our Dockerfile as a reference

  2. The image was uploaded to the internal registry

  3. code quality check via codeclimate 

  4. A deployment to was triggered under a domain which contains projectname+staging

If you check your dashboard you should see the project.

In GitLab you now have a staging environment from where you can also access the staging domain. This is the moment where the project manager, quality department or your customer checks the staging version and if everything is ok the deployment to production can be triggered with one click.

You can find the code of this how-to at .


Did this answer your question?