Skip to content

Commit

Permalink
Merge pull request #10 from iolave/staging
Browse files Browse the repository at this point in the history
v1.1.0 Release
  • Loading branch information
iolave committed May 1, 2024
2 parents 292112e + ad3ab62 commit 4dd56f1
Show file tree
Hide file tree
Showing 6 changed files with 180 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/apt-dependencies-updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
push:
branches: [ main ]
schedule:
- cron: "0 0 * * *"
- cron: "0 0 * * 1"

jobs:
dependency-updater:
Expand Down
144 changes: 144 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
name: Docker publish

on:
push:
branches: [ "main" ]
paths-ignore: [
".github",
"README.md",
"LICENSE"
]

jobs:
get-version-file-version:
name: Get version
runs-on: "ubuntu-latest"
outputs:
current_version: ${{ steps.get_version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get version file version
id: get_version
shell: bash
run: |
if [ ! -f "./version" ]; then
echo "ERROR: version file does not exist"
exit 1
fi
CURRENT_VERSION=$(cat version | sed s/v//g)
echo "current version: $CURRENT_VERSION"
echo "version=$CURRENT_VERSION" >> "$GITHUB_OUTPUT"
get-tags:
name: Get tags
runs-on: "ubuntu-latest"
outputs:
patch: ${{ steps.tags.outputs.patch }}
minor: ${{ steps.tags.outputs.minor }}
major: ${{ steps.tags.outputs.major }}
full: ${{ steps.tags.outputs.full }}
needs: [ get-version-file-version ]
steps:
- name: Get Major/Minor/Patch tags
id: tags
shell: bash
run: |
TAG_PATCH=$(echo ${{ needs.get-version-file-version.outputs.current_version }} | cut -d '.' -f 1,2,3)
TAG_MINOR=$(echo ${{ needs.get-version-file-version.outputs.current_version }} | cut -d '.' -f 1,2)
TAG_MAJOR=$(echo ${{ needs.get-version-file-version.outputs.current_version }} | cut -d '.' -f 1)
TAG_FULL=$TAG_PATCH
echo "patch tag: $TAG_PATCH"; echo "patch=$TAG_PATCH" >> "$GITHUB_OUTPUT"
echo "minor tag: $TAG_MINOR"; echo "minor=$TAG_MINOR" >> "$GITHUB_OUTPUT"
echo "major tag: $TAG_MAJOR"; echo "major=$TAG_MAJOR" >> "$GITHUB_OUTPUT"
echo "full tag: $TAG_FULL"; echo "full=$TAG_FULL" >> "$GITHUB_OUTPUT"
check-tags:
name: Check for existing tags
runs-on: "ubuntu-latest"
outputs:
exists_latest: ${{ steps.check_tags.outputs.exists_latest }}
needs: [ get-tags ]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check tags
id: check_tags
shell: bash
run: |
tags=$(git --no-pager tag --list)
patch="${{ needs.get-tags.outputs.patch }}"
if [[ $tags =~ "${{ needs.get-tags.outputs.patch }}" ]]; then
echo "ERROR: tag $patch exists. Try removing it manually";
exit 1
else
echo "INFO: tag $patch does not exist. All looks good"
fi
push-tags:
name: Push tags
runs-on: "ubuntu-latest"
needs: [ get-tags, check-tags ]
steps:
- name: Push patch tag
uses: pkgdeps/git-tag-action@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
github_repo: ${{ github.repository }}
git_commit_sha: ${{ github.sha }}
version: ${{ needs.get-tags.outputs.patch }}
publish:
name: Build docker image and publish
runs-on: ubuntu-latest
needs: [ get-tags, push-tags ]
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
tags: |
iolave/clamav:latest, iolave/clamav:${{ needs.get-tags.outputs.patch }}, iolave/clamav:${{ needs.get-tags.outputs.minor }}, iolave/clamav:${{ needs.get-tags.outputs.major }}
create-release:
runs-on: "ubuntu-latest"
needs: [ get-tags, check-tags, push-tags ]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get previous version from CHANGELOG
id: prev
shell: bash
run: |
prev_version=$(cat CHANGELOG.md | grep -o '##\ v[0-9]*\.[0-9]*\.[0-9]*' | sed -e s/##\ //g | sed -n 2p)
echo "Previous version: $prev_version"
echo "previous_version=$prev_version" >> "$GITHUB_OUTPUT"
- name: Set release notes
id: notes
shell: bash
run: |
echo "# CHANGELOG" > release-notes.md
prev_version=$(cat CHANGELOG.md | grep -o '##\ v[0-9]*\.[0-9]*\.[0-9]*' | sed -e s/##\ //g | sed -n 2p)
sed -n '/## v${{ needs.get-tags.outputs.patch }}/,/## ${{ steps.prev.outputs.previous_version }}/p' CHANGELOG.md | sed -e s/##\ v[0-9]*\.[0-9]*\.[0-9]*//g >> release-notes.md
echo "**Full Changelog**: https://github.com/iolave/docker-clamav/compare/v${{ needs.get-tags.outputs.patch }}...${{ steps.prev.outputs.previous_version }}" >> release-notes.md
notes=$(cat release-notes.md | base64 -w 0)
echo "release_notes=$notes" >> "$GITHUB_OUTPUT"
- uses: akiojin/decode-base64-github-action@v0.1.0
id: decode-base64
with:
base64: ${{ steps.notes.outputs.release_notes }}
- name: Output release notes
shell: bash
run: echo "${{ steps.decode-base64.outputs.decoded }}"
- name: Release pushed tag
uses: softprops/action-gh-release@v2
with:
body: ${{ steps.decode-base64.outputs.decoded }}
tag_name: v${{ needs.get-tags.outputs.patch }}
make_latest: true
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# CHANGELOG
## v1.1.0
### MINOR
- Changed default exposed port to `3310` as [clamav docs](https://docs.clamav.net) says.
### PATCH
- Adds `version` file for managing releases.

## v1.0.1
### PATCH
- Moved apt dependencies to config `config/apt-dependencies.json` file.
- Adds a GitHub workflow that checks for newer versions of apt packages.
- Adds docker hub tags link to README.

## v1.0.0
### MAJOR
- Adds `fresclam.conf` file to allow user settings.
- Exposes port `6666` for daemon.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu:24.04

EXPOSE 6666/tcp
EXPOSE 3310/tcp

USER root
RUN apt update
Expand All @@ -13,7 +13,7 @@ RUN apt install -y jq
RUN echo $(cat apt-dependencies.json | jq -r '."clamav-daemon"') >> tmp

RUN apt install -y clamav-daemon=$(cat apt-dependencies.json | jq -r '."clamav-daemon"')
RUN echo "TCPSocket 6666" >> /etc/clamav/clamd.conf
RUN echo "TCPSocket 3310" >> /etc/clamav/clamd.conf
RUN /etc/init.d/clamav-freshclam stop

RUN freshclam --config-file freshclam.conf
Expand Down
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
<p align="center"><img src="https://img.shields.io/docker/pulls/iolave/clamav?logo=docker"></img></p>

# ClamAV daemon docker image

<p align="center"><img src="https://i.imghippo.com/files/HLZfZ1713358376.png"></img></p>

This image spins up a ClamAV daemon instance allowing to build services alongside it with tools like the [nodejs clamscan package](https://www.npmjs.com/package/clamscan).


- Feel free to experiment modifying the `./config/fresclam.conf` file for your needs.
- Docker args are not allowed yet for settings like `fresclam.conf` and `clamd.conf`
- Exposes port `6666`.
- Docker envs are not yet supported for clamav related settings (`fresclam.conf` and `clamd.conf` files).
- Exposes port `3310`.

## Usage
### Build locally
Clone this repository or download the [latest release](https://github.com/iolave/docker-clamav/releases/latest) and run the following docker build command:

```bash
docker build -t iolave/clamav .
```

## Create a container
### Pre-build image
```bash
docker run -p 6666:6666 iolave/clamav
docker run -p 3310:3310 iolave/clamav
```

## Tags
Expand Down
1 change: 1 addition & 0 deletions version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.1.0

0 comments on commit 4dd56f1

Please sign in to comment.