Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
szaimen authored Oct 2, 2023
0 parents commit 60044a8
Show file tree
Hide file tree
Showing 8 changed files with 892 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
time: "12:00"
open-pull-requests-limit: 10
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "daily"
time: "12:00"
open-pull-requests-limit: 10
labels:
- 3. to review
- dependencies
42 changes: 42 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Docker Build and Publish

on:
workflow_dispatch:
inputs:
tagName:
description: "Tag name"
required: true
default: 'v1'

jobs:
push_to_registry:
runs-on: ubuntu-latest

name: Build docker image and push to dockerhub

steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build container image
uses: docker/build-push-action@v5
with:
push: true
platforms: linux/amd64,linux/arm64
context: './'
no-cache: true
file: 'Dockerfile'
tags: szaimen/aio-fail2ban:${{ github.event.inputs.tagName }}
provenance: false
37 changes: 37 additions & 0 deletions .github/workflows/docker-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Docker Lint

on:
pull_request:
push:
branches:
- main

permissions:
contents: read

jobs:
docker-lint:
runs-on: ubuntu-latest

name: docker-lint

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install hadolint
run: |
sudo wget https://github.com/hadolint/hadolint/releases/latest/download/hadolint-Linux-x86_64 -O /usr/bin/hadolint
sudo chmod +x /usr/bin/hadolint
- name: run lint
run: |
DOCKERFILES="$(find ./ -name Dockerfile)"
mapfile -t DOCKERFILES <<< "$DOCKERFILES"
for file in "${DOCKERFILES[@]}"; do
# DL4006 warning: Set the SHELL option -o pipefail before RUN with a pipe in it. If you are using /bin/sh in an alpine image or if your shell is symlinked to busybox then consider explicitly setting your SHELL to /bin/ash, or disable this check
hadolint "$file" --ignore DL4006 | tee -a ./hadolint.log
done
if grep -q "DL[0-9]\+\|SC[0-9]\+" ./hadolint.log; then
exit 1
fi
24 changes: 24 additions & 0 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Shellcheck

on:
pull_request:
paths:
- '**.sh'
push:
branches:
- main
paths:
- '**.sh'

jobs:
shellcheck:
name: Check Shell
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Shellcheck
uses: ludeeus/[email protected]
with:
check_together: 'yes'
env:
SHELLCHECK_OPTS: --shell bash
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM alpine:3.18.4

# hadolint ignore=DL3018
RUN set -ex; \
apk add --no-cache fail2ban tzdata util-linux-misc bash nftables ip6tables; \
mv /etc/fail2ban/filter.d/common.conf /tmp/; \
rm -r /etc/fail2ban/jail.d/*; \
rm -r /etc/fail2ban/filter.d/*; \
mv /tmp/common.conf /etc/fail2ban/filter.d/

COPY --chmod=775 start.sh /start.sh

# hadolint ignore=DL3002
USER root
ENTRYPOINT [ "/start.sh" ]
Loading

0 comments on commit 60044a8

Please sign in to comment.