drm_hwcomposer: CI: use local container image for building

The freedesktop instance provides a docker container registry with
ubuntu 23.04 based images ready to be used for building drm_hwcomposer.

Migrate to using that container image in order to:
- Avoid apt-get installing all dependencies for each job
- Remove duplication between the Dockerfile and the .gitlab-ci.yml

Since the container image provides aospless, we no longer need to download it
for each pipeline stage.
Also, this updates the folder structure:

Before:
/builds/drm-hwcomposer/drm-hwcomposer/
/builds/drm-hwcomposer/aospless

After:
/builds/drm-hwcomposer/drm-hwcomposer/
/home/user/aospless

For "tidy", this new structure requires to override the BASE_DIR variable.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
diff --git a/.ci/Makefile b/.ci/Makefile
index a30414c..3ca7560 100644
--- a/.ci/Makefile
+++ b/.ci/Makefile
@@ -1,5 +1,5 @@
 
-BASE_DIR:=../aospless
+BASE_DIR ?=../aospless
 
 SYSTEM_INCLUDE_DIRS := /usr/include/libdrm
 
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 30ebfd5..f55499f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,5 +1,3 @@
-image: ubuntu:23.04
-
 workflow:
   rules:
     - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
@@ -9,12 +7,6 @@
   DEBIAN_FRONTEND: noninteractive
   DOCKER_IMAGE_TAG: $CI_REGISTRY_IMAGE:latest
 
-before_script:
-  - apt-get --quiet update --yes >/dev/null
-  - apt-get --quiet install --yes clang-15 clang-tidy-15 clang-format-15 git libdrm-dev blueprint-tools libgtest-dev make >/dev/null
-  - apt-get --quiet install --yes clang llvm make python3 wget sudo rsync lld pkg-config ninja-build meson >/dev/null
-  - apt-get --quiet install --yes python3-mako python3-jinja2 python3-ply python3-yaml >/dev/null
-
 stages:
   - build-container
   - build
@@ -38,17 +30,13 @@
 
 build:
   stage: build
+  image: $DOCKER_IMAGE_TAG
   script:
     - mkdir -p install/arm64
-    - cd ..
-    - rm -f aospless_drm_hwcomposer_arm64.tar.xz
-    - rm -rf aospless/*
-    - wget https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/uploads/28ef9379b1a0ec1ee19a17825b0f3f3f/aospless_drm_hwcomposer_arm64.tar.xz
-    - tar xf aospless_drm_hwcomposer_arm64.tar.xz
-    - rm -r aospless/src
-    - ln -s ../drm-hwcomposer/ aospless/src
-    - make -C ./aospless all
-    - cp -r aospless/install/* drm-hwcomposer/install/arm64
+    - rm ${HOME}/aospless/src
+    - ln -s ${PWD} ${HOME}/aospless/src
+    - make -C ${HOME}/aospless all
+    - cp -r ${HOME}/aospless/install/* install/arm64
 
   artifacts:
     paths:
@@ -57,17 +45,15 @@
 
 tidy:
   stage: tidy
+  image: $DOCKER_IMAGE_TAG
   script:
-    - cd ..
-    - rm -f aospless_drm_hwcomposer_arm64.tar.xz
-    - rm -rf aospless/*
-    - wget https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/uploads/28ef9379b1a0ec1ee19a17825b0f3f3f/aospless_drm_hwcomposer_arm64.tar.xz
-    - tar xf aospless_drm_hwcomposer_arm64.tar.xz
-    - cd -
-    - make -f .ci/Makefile
+    - rm ${HOME}/aospless/src
+    - ln -s ${PWD} ${HOME}/aospless/src
+    - BASE_DIR=${HOME}/aospless make -f .ci/Makefile
 
 checkstyle:
   stage: style
+  image: $DOCKER_IMAGE_TAG
   script: "./.ci/.gitlab-ci-checkcommit.sh"
   artifacts:
     when: on_failure