From f739ea4aa7e731f6983639c715b03abdbc9fed92 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Sat, 23 Jan 2021 22:55:03 +0200
Subject: [PATCH] Quite a few updates.

- pre-commit.
- Address a few issued from pre-commit.
- GitLab CI.
- License.
- Stricter .dockerignore.
- Add contact info to README.
- Personal registry.
---
 .dockerignore           |  5 ++---
 .gitlab-ci.yml          | 22 +++++++++++++++++++
 .pre-commit-config.yaml | 48 +++++++++++++++++++++++++++++++++++++++++
 Dockerfile              |  3 ++-
 LICENSE.txt             | 21 ++++++++++++++++++
 README.md               | 17 ++++++++++++++-
 entrypoint              |  2 +-
 7 files changed, 112 insertions(+), 6 deletions(-)
 create mode 100644 .gitlab-ci.yml
 create mode 100644 .pre-commit-config.yaml
 create mode 100644 LICENSE.txt

diff --git a/.dockerignore b/.dockerignore
index 4160180..91445b9 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,3 +1,2 @@
-.git/
-README*
-*.swp
+*
+!entrypoint
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..7054b39
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,22 @@
+---
+include:
+  - project: shore/ci-templates
+    file: templates/pre-commit.yml
+  - project: shore/ci-templates
+    file: templates/docker.yml
+
+stages:
+  - test
+  - build
+  - deploy
+
+variables:
+  IMAGE: resolver
+
+build:
+  extends: .docker-build-shore
+  tags: [ns4.shore.co.il]
+
+push:
+  extends: .docker-push-shore
+  tags: [ns4.shore.co.il]
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..13d68fd
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,48 @@
+---
+repos:
+  - repo: https://github.com/pre-commit/pre-commit-hooks.git
+    rev: v3.4.0
+    hooks:
+      - id: check-added-large-files
+      - id: check-executables-have-shebangs
+      - id: check-merge-conflict
+      - id: check-symlinks
+      - id: trailing-whitespace
+
+  - repo: https://github.com/Yelp/detect-secrets
+    rev: v0.14.3
+    hooks:
+      - id: detect-secrets
+
+  - repo: https://github.com/adrienverge/yamllint
+    rev: v1.25.0
+    hooks:
+      - id: yamllint
+
+  - repo: https://github.com/amperser/proselint/
+    rev: 0.10.2
+    hooks:
+      - id: proselint
+        types: [plain-text]
+        exclude: LICENSE
+
+  - repo: https://github.com/executablebooks/mdformat.git
+    rev: 0.5.3
+    hooks:
+      - id: mdformat
+
+  - repo: https://git.shore.co.il/nimrod/shell-pre-commit.git
+    rev: v0.6.0
+    hooks:
+      - id: shell-lint
+
+  - repo: https://github.com/shellcheck-py/shellcheck-py.git
+    rev: v0.7.1.1
+    hooks:
+      - id: shellcheck
+
+  - repo: https://git.shore.co.il/nimrod/docker-pre-commit.git/
+    rev: v0.3.0
+    hooks:
+      - id: hadolint
+      - id: docker-compose
diff --git a/Dockerfile b/Dockerfile
index c6369c4..de9f846 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,5 @@
-FROM alpine:latest
+FROM alpine:3.13
+# hadolint ignore=DL3018
 RUN echo '@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories && \
     echo '@community http://dl-cdn.alpinelinux.org/alpine/edge/community' >> /etc/apk/repositories && \
     apk add --update --no-cache \
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..a9e1ecf
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2021 Adar Nimrod
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
index cff10ad..ae799d2 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,23 @@
 # Resolver
 
+[![pipeline status](https://git.shore.co.il/nimrod/resolver/badges/master/pipeline.svg)](https://git.shore.co.il/nimrod/resolver/-/commits/master)
+
 Testing DNS with a clean cache resolver. More info at
 https://www.shore.co.il/blog/resolver/.
 
 ## Usage
 
-    docker run --rm -it adarnimrod/resolver
+```
+docker run --rm -it registry.shore.co.il/resolver
+```
+
+## License
+
+This software is licensed under the MIT license (see `LICENSE.txt`).
+
+## Author Information
+
+Nimrod Adar, [contact me](mailto:nimrod@shore.co.il) or visit my
+[website](https://www.shore.co.il/). Patches are welcome via
+[`git send-email`](http://git-scm.com/book/en/v2/Git-Commands-Email). The repository
+is located at: <https://git.shore.co.il/explore/>.
diff --git a/entrypoint b/entrypoint
index 658be82..08f93c7 100755
--- a/entrypoint
+++ b/entrypoint
@@ -2,4 +2,4 @@
 set -eux
 kresd --addr '127.0.0.1' --noninteractive &
 echo 'nameserver 127.0.0.1' > /etc/resolv.conf
-eval "exec gosu nobody:nobody $@"
+eval exec gosu nobody:nobody "$@"
-- 
GitLab