Compare commits
2 Commits
5732fb7aa0
...
db8529e560
| Author | SHA1 | Date | |
|---|---|---|---|
| db8529e560 | |||
| 114edffa0a |
@@ -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
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:
|
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 }}
|
|
||||||
|
|||||||
33
.github/workflows/tag.yaml
vendored
33
.github/workflows/tag.yaml
vendored
@@ -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
3
.gitignore
vendored
@@ -1,2 +1 @@
|
|||||||
prosody-filer-s3
|
bin/
|
||||||
!cmd/prosody-filer-s3
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
"group:allNonMajor",
|
"group:allNonMajor",
|
||||||
"schedule:monthly",
|
"schedule:monthly",
|
||||||
],
|
],
|
||||||
"enabledManagers": ["gomod"],
|
"enabledManagers": ["github-actions", "gomod"],
|
||||||
"osvVulnerabilityAlerts": true
|
"osvVulnerabilityAlerts": true,
|
||||||
|
"postUpdateOptions": ["gomodTidy"]
|
||||||
}
|
}
|
||||||
|
|||||||
12
Dockerfile
12
Dockerfile
@@ -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
|
||||||
|
|
||||||
|
|||||||
2
Makefile
2
Makefile
@@ -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:
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
Reference in New Issue
Block a user