CI: Use own package as base
authorLain Soykaf <lain@lain.com>
Sun, 26 Dec 2021 17:05:42 +0000 (18:05 +0100)
committerLain Soykaf <lain@lain.com>
Sun, 26 Dec 2021 17:05:42 +0000 (18:05 +0100)
So we can skip updating and installing the same packages a million
times. It will still grab the hex.pm stuff -- maybe we can find a way to
avoid this, too.

.gitlab-ci.yml
ci/Dockerfile [new file with mode: 0644]
ci/build_and_push.sh [new file with mode: 0755]

index 3860f1db9522a07adb05cbccb1b0d9182b44dd39..9155af0e5b0477367a8022699e489c11cb7cf572 100644 (file)
@@ -1,4 +1,4 @@
-image: elixir:1.9.4
+image: git.pleroma.social:5050/pleroma/pleroma/ci-base
 
 variables: &global_variables
   POSTGRES_DB: pleroma_test
@@ -26,12 +26,7 @@ stages:
 before_script:
   - echo $MIX_ENV
   - rm -rf _build/*/lib/pleroma
-  - apt-get update && apt-get install -y cmake
-  - mix local.hex --force
-  - mix local.rebar --force
   - mix deps.get
-  - apt-get -qq update
-  - apt-get install -y libmagic-dev
 
 after_script:
   - rm -rf _build/*/lib/pleroma
@@ -88,7 +83,6 @@ unit-testing:
     alias: postgres
     command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
   script:
-    - apt-get update && apt-get install -y libimage-exiftool-perl ffmpeg
     - mix ecto.create
     - mix ecto.migrate
     - mix coveralls --preload-modules
@@ -146,7 +140,6 @@ unit-testing-rum:
     <<: *global_variables
     RUM_ENABLED: "true"
   script:
-    - apt-get update && apt-get install -y libimage-exiftool-perl ffmpeg
     - mix ecto.create
     - mix ecto.migrate
     - "mix ecto.migrate --migrations-path priv/repo/optional_migrations/rum_indexing/"
diff --git a/ci/Dockerfile b/ci/Dockerfile
new file mode 100644 (file)
index 0000000..e6a8b43
--- /dev/null
@@ -0,0 +1,7 @@
+FROM elixir:1.9.4
+
+RUN apt-get update &&\
+  apt-get install -y libmagic-dev cmake libimage-exiftool-perl ffmpeg &&\
+       mix local.hex --force &&\
+       mix local.rebar --force
+
diff --git a/ci/build_and_push.sh b/ci/build_and_push.sh
new file mode 100755 (executable)
index 0000000..484cc26
--- /dev/null
@@ -0,0 +1 @@
+docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t git.pleroma.social:5050/pleroma/pleroma/ci-base:latest --push .