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
.dockerignore
Dockerfile
LICENSE
Makefile
*.md
*.jpg
docker-compose.yaml
prosody-filer-s3
!cmd/prosody-filer-s3
*
!bin/

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

@@ -18,13 +18,13 @@ jobs:
uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Start minio
- name: Run minio
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
./minio server /data &
while ! curl -s -f http://localhost:9000/minio/health/live; do
@@ -34,42 +34,13 @@ jobs:
- name: Run unit tests
run: go test -v ./...
- name: Stop minio
if: always()
run: pkill -f minio
build:
name: Build docker image
needs: test
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- 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: 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
uses: ./.github/workflows/build.yaml
with:
push: ${{ github.ref_name == 'main' }}
tags: git.mug.lv/${{ github.repository }}:${{ steps.metadata.outputs.version }}
secrets: inherit

View File

@@ -10,28 +10,7 @@ on:
jobs:
build:
name: Build docker image
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- 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
uses: ./.github/workflows/build.yaml
with:
push: true
tags: git.mug.lv/${{ github.repository }}:${{ github.ref_name }}
secrets: inherit

3
.gitignore vendored
View File

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

View File

@@ -1,4 +1,11 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"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
WORKDIR /build
COPY . /build
RUN go build ./...
FROM alpine:3.20
FROM alpine:3.21
RUN apk add -U --no-cache ca-certificates tini && \
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
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

View File

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