3 Commits

Author SHA1 Message Date
db8529e560 Update renovate config
All checks were successful
Main workflow / Run unit tests (push) Successful in 3m5s
Main workflow / build (push) Successful in 25s
2025-03-31 15:18:28 +02:00
114edffa0a Improve CI
All checks were successful
Main workflow / Run unit tests (push) Successful in 26s
Main workflow / build (push) Successful in 24s
2025-03-31 15:14:34 +02:00
5732fb7aa0 Update renovate settings
All checks were successful
Main workflow / Run unit tests (push) Successful in 1m55s
Main workflow / Build docker image (push) Successful in 2m6s
2024-12-19 15:47:49 +01:00
9 changed files with 95 additions and 109 deletions

View File

@@ -1,11 +1,2 @@
.git/ *
.gitignore !bin/
.dockerignore
Dockerfile
LICENSE
Makefile
*.md
*.jpg
docker-compose.yaml
prosody-filer-s3
!cmd/prosody-filer-s3

47
.github/workflows/build.yaml vendored Normal file
View File

@@ -0,0 +1,47 @@
---
name: Build image
on:
workflow_call:
inputs:
push:
description: Whether to push the image
type: boolean
required: true
jobs:
build:
name: Build docker image
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Login to registry
if: ${{ inputs.push }}
uses: docker/login-action@v3
with:
registry: git.mug.lv
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Setup buildx
uses: docker/setup-buildx-action@v3
- name: Setup go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Build binary
run: make build
env:
CGO_ENABLED: 0
- name: Build image
uses: docker/build-push-action@v6
with:
context: .
push: ${{ inputs.push }}
tags: git.mug.lv/${{ github.repository }}:${{ github.ref_name }}

View File

@@ -4,9 +4,9 @@ name: Main workflow
on: on:
push: push:
branches: branches:
- '**' - '**'
tags-ignore: tags-ignore:
- '**' - '**'
jobs: jobs:
test: test:
@@ -14,62 +14,33 @@ jobs:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
timeout-minutes: 5 timeout-minutes: 5
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup go - name: Setup go
uses: actions/setup-go@v4 uses: actions/setup-go@v5
with: with:
go-version-file: go.mod go-version-file: go.mod
- name: Start minio - name: Run minio
run: | run: |
wget https://dl.min.io/server/minio/release/linux-amd64/minio wget -q https://dl.min.io/server/minio/release/linux-amd64/minio
chmod +x minio chmod +x minio
./minio server /data & ./minio server /data &
while ! curl -s -f http://localhost:9000/minio/health/live; do while ! curl -s -f http://localhost:9000/minio/health/live; do
sleep 1 sleep 1
done done
- name: Run unit tests - name: Run unit tests
run: go test -v ./... run: go test -v ./...
- name: Stop minio
if: always()
run: pkill -f minio
build: build:
name: Build docker image
needs: test needs: test
runs-on: ubuntu-22.04 uses: ./.github/workflows/build.yaml
timeout-minutes: 5 with:
steps: push: ${{ github.ref_name == 'main' }}
- name: Checkout repository secrets: inherit
uses: actions/checkout@v4
- name: Install docker
uses: actions/docker-install@v1
- name: Login to registry
uses: actions/docker-login@v2
with:
registry: git.mug.lv
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Setup buildx
uses: actions/docker-setup-buildx@v2
- name: Get version
id: metadata
run: |
if [ "$REF_NAME" = 'main' ]; then
version='latest'
else
version="${REF_NAME//\//-}"
fi
echo "version=$version" | tee -a "$GITHUB_OUTPUT"
env:
REF_NAME: ${{ github.ref_name }}
- name: Build image
uses: actions/docker-build-push@v4
with:
push: ${{ github.ref_name == 'main' }}
tags: git.mug.lv/${{ github.repository }}:${{ steps.metadata.outputs.version }}

View File

@@ -4,34 +4,13 @@ name: Main workflow
on: on:
push: push:
branches-ignore: branches-ignore:
- '**' - '**'
tags: tags:
- '**' - '**'
jobs: jobs:
build: build:
name: Build docker image uses: ./.github/workflows/build.yaml
runs-on: ubuntu-22.04 with:
timeout-minutes: 5 push: true
steps: secrets: inherit
- name: Checkout repository
uses: actions/checkout@v4
- name: Install docker
uses: actions/docker-install@v1
- name: Login to registry
uses: actions/docker-login@v2
with:
registry: git.mug.lv
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Setup buildx
uses: actions/docker-setup-buildx@v2
- name: Build image
uses: actions/docker-build-push@v4
with:
push: true
tags: git.mug.lv/${{ github.repository }}:${{ github.ref_name }}

3
.gitignore vendored
View File

@@ -1,2 +1 @@
prosody-filer-s3 bin/
!cmd/prosody-filer-s3

View File

@@ -1,4 +1,11 @@
{ {
"$schema": "https://docs.renovatebot.com/renovate-schema.json", "$schema": "https://docs.renovatebot.com/renovate-schema.json",
"dependencyDashboard": true, "dependencyDashboard": true,
"extends": [
"group:allNonMajor",
"schedule:monthly",
],
"enabledManagers": ["github-actions", "gomod"],
"osvVulnerabilityAlerts": true,
"postUpdateOptions": ["gomodTidy"]
} }

View File

@@ -1,18 +1,10 @@
FROM golang:1.22-alpine AS build FROM alpine:3.21
WORKDIR /build
COPY . /build
RUN go build ./...
FROM alpine:3.20
RUN apk add -U --no-cache ca-certificates tini && \ RUN apk add -U --no-cache ca-certificates tini && \
addgroup -g 1000 prosody-filer-s3 && \ addgroup -g 1000 prosody-filer-s3 && \
adduser -h /var/lib/empty -G prosody-filer-s3 -s /sbin/nologin -D -H -u 1000 prosody-filer-s3 adduser -h /var/lib/empty -G prosody-filer-s3 -s /sbin/nologin -D -H -u 1000 prosody-filer-s3
COPY --from=build /build/prosody-filer-s3 /usr/local/bin/prosody-filer-s3 COPY bin/prosody-filer-s3 /usr/local/bin/prosody-filer-s3
USER 1000 USER 1000

View File

@@ -1,6 +1,6 @@
.PHONY: build .PHONY: build
build: build:
go build ./... go build -o bin/ ./cmd/prosody-filer-s3
.PHONY: clean .PHONY: clean
clean: clean:

View File

@@ -4,7 +4,7 @@ services:
minio: minio:
image: minio/minio:latest image: minio/minio:latest
command: command:
- server - server
- /data - /data
ports: ports:
- "9000:9000" - "9000:9000"