Compare commits
2 Commits
5732fb7aa0
...
db8529e560
| Author | SHA1 | Date | |
|---|---|---|---|
| db8529e560 | |||
| 114edffa0a |
@@ -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
47
.github/workflows/build.yaml
vendored
Normal 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 }}
|
||||
81
.github/workflows/main.yaml
vendored
81
.github/workflows/main.yaml
vendored
@@ -4,9 +4,9 @@ name: Main workflow
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '**'
|
||||
- '**'
|
||||
tags-ignore:
|
||||
- '**'
|
||||
- '**'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
@@ -14,62 +14,33 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
- name: Setup go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
|
||||
- name: Start minio
|
||||
run: |
|
||||
wget 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
|
||||
sleep 1
|
||||
done
|
||||
- name: Run minio
|
||||
run: |
|
||||
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
|
||||
sleep 1
|
||||
done
|
||||
|
||||
- name: Run unit tests
|
||||
run: go test -v ./...
|
||||
- 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
|
||||
with:
|
||||
push: ${{ github.ref_name == 'main' }}
|
||||
tags: git.mug.lv/${{ github.repository }}:${{ steps.metadata.outputs.version }}
|
||||
uses: ./.github/workflows/build.yaml
|
||||
with:
|
||||
push: ${{ github.ref_name == 'main' }}
|
||||
secrets: inherit
|
||||
|
||||
33
.github/workflows/tag.yaml
vendored
33
.github/workflows/tag.yaml
vendored
@@ -4,34 +4,13 @@ name: Main workflow
|
||||
on:
|
||||
push:
|
||||
branches-ignore:
|
||||
- '**'
|
||||
- '**'
|
||||
tags:
|
||||
- '**'
|
||||
- '**'
|
||||
|
||||
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
|
||||
with:
|
||||
push: true
|
||||
tags: git.mug.lv/${{ github.repository }}:${{ github.ref_name }}
|
||||
uses: ./.github/workflows/build.yaml
|
||||
with:
|
||||
push: true
|
||||
secrets: inherit
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,2 +1 @@
|
||||
prosody-filer-s3
|
||||
!cmd/prosody-filer-s3
|
||||
bin/
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"group:allNonMajor",
|
||||
"schedule:monthly",
|
||||
],
|
||||
"enabledManagers": ["gomod"],
|
||||
"osvVulnerabilityAlerts": true
|
||||
"enabledManagers": ["github-actions", "gomod"],
|
||||
"osvVulnerabilityAlerts": true,
|
||||
"postUpdateOptions": ["gomodTidy"]
|
||||
}
|
||||
|
||||
12
Dockerfile
12
Dockerfile
@@ -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
|
||||
|
||||
|
||||
2
Makefile
2
Makefile
@@ -1,6 +1,6 @@
|
||||
.PHONY: build
|
||||
build:
|
||||
go build ./...
|
||||
go build -o bin/ ./cmd/prosody-filer-s3
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
|
||||
@@ -4,7 +4,7 @@ services:
|
||||
minio:
|
||||
image: minio/minio:latest
|
||||
command:
|
||||
- server
|
||||
- /data
|
||||
- server
|
||||
- /data
|
||||
ports:
|
||||
- "9000:9000"
|
||||
- "9000:9000"
|
||||
|
||||
Reference in New Issue
Block a user