From 5096e37d3413af76b1b53009857c02efe7cf4523 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Sat, 23 Oct 2021 21:10:15 +0300
Subject: [PATCH] Add pre-commit image.

---
 .gitlab-ci.yml                  | 17 +++++++++++++++++
 images/pre-commit/.dockerignore |  1 +
 images/pre-commit/Dockerfile    | 19 +++++++++++++++++++
 3 files changed, 37 insertions(+)
 create mode 100644 images/pre-commit/.dockerignore
 create mode 100644 images/pre-commit/Dockerfile

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f4dd656..09564c9 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -106,3 +106,20 @@ push-k8s:
   needs:
     - job: build-k8s
       artifacts: true
+
+# pre-commit image:
+
+build-pre-commit:
+  extends: .container-build
+  variables:
+    CONTEXT: images/pre-commit
+
+push-pre-commit:
+  extends: .container-push
+  variables:
+    CONTEXT: images/pre-commit
+    IMAGE: ci-images
+    TAG: pre-commit
+  needs:
+    - job: build-pre-commit
+      artifacts: true
diff --git a/images/pre-commit/.dockerignore b/images/pre-commit/.dockerignore
new file mode 100644
index 0000000..72e8ffc
--- /dev/null
+++ b/images/pre-commit/.dockerignore
@@ -0,0 +1 @@
+*
diff --git a/images/pre-commit/Dockerfile b/images/pre-commit/Dockerfile
new file mode 100644
index 0000000..6794071
--- /dev/null
+++ b/images/pre-commit/Dockerfile
@@ -0,0 +1,19 @@
+FROM buildpack-deps:bullseye
+# hadolint ignore=DL3008,DL3013
+RUN apt-get update && \
+    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
+        docker.io \
+        python3-dev \
+        python3-pip \
+        python3-setuptools \
+        python3-venv \
+    && \
+    python3 -m pip install --no-cache-dir --upgrade pip && \
+    python3 -m pip install --no-cache-dir \
+        docker-compose \
+        pipenv \
+        poetry \
+        pre_commit \
+        tox \
+    && \
+    rm -rf /root/.cache /tmp/* /var/tmp/* /var/lib/apt/lists/* /var/cache/apt/archives/*
-- 
GitLab