This commit is contained in:
parent
173856e2aa
commit
557b221c8b
4 changed files with 234 additions and 0 deletions
137
.drone.yml
Normal file
137
.drone.yml
Normal file
|
@ -0,0 +1,137 @@
|
|||
kind: pipeline
|
||||
type: docker
|
||||
name: linux-amd64
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: docker
|
||||
image: plugins/docker
|
||||
settings:
|
||||
purge: true
|
||||
no_cache: true
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-amd64
|
||||
repo: spcodes/filtron
|
||||
build_args:
|
||||
- ARCH=amd64
|
||||
username:
|
||||
from_secret: USERNAME
|
||||
password:
|
||||
from_secret: PASSWORD
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- main
|
||||
event:
|
||||
- push
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: linux-arm
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: arm
|
||||
|
||||
steps:
|
||||
- name: docker
|
||||
image: plugins/docker
|
||||
settings:
|
||||
purge: true
|
||||
no_cache: true
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-arm
|
||||
repo: spcodes/filtron
|
||||
build_args:
|
||||
- ARCH=arm
|
||||
username:
|
||||
from_secret: USERNAME
|
||||
password:
|
||||
from_secret: PASSWORD
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- main
|
||||
event:
|
||||
- push
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: linux-arm64
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: arm64
|
||||
|
||||
steps:
|
||||
- name: docker
|
||||
image: plugins/docker
|
||||
settings:
|
||||
purge: true
|
||||
no_cache: true
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-arm64
|
||||
repo: spcodes/filtron
|
||||
build_args:
|
||||
- ARCH=arm64
|
||||
username:
|
||||
from_secret: USERNAME
|
||||
password:
|
||||
from_secret: PASSWORD
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- main
|
||||
event:
|
||||
- push
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: manifest
|
||||
|
||||
steps:
|
||||
- name: publish-version
|
||||
image: plugins/manifest
|
||||
settings:
|
||||
ignore_missing: true
|
||||
target: spcodes/filtron:v0.1.0
|
||||
template: spcodes/filtron:OS-ARCH
|
||||
platforms:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
- linux/arm
|
||||
username:
|
||||
from_secret: USERNAME
|
||||
password:
|
||||
from_secret: PASSWORD
|
||||
- name: publish-latest
|
||||
image: plugins/manifest
|
||||
settings:
|
||||
ignore_missing: true
|
||||
target: spcodes/filtron
|
||||
template: spcodes/filtron:OS-ARCH
|
||||
platforms:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
- linux/arm
|
||||
username:
|
||||
from_secret: USERNAME
|
||||
password:
|
||||
from_secret: PASSWORD
|
||||
|
||||
depends_on:
|
||||
- linux-amd64
|
||||
- linux-arm64
|
||||
- linux-arm
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- main
|
||||
event:
|
||||
- push
|
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
.idea/
|
||||
*.iml
|
33
Dockerfile
Normal file
33
Dockerfile
Normal file
|
@ -0,0 +1,33 @@
|
|||
ARG ARCH
|
||||
|
||||
# STEP 1 build executable binary
|
||||
FROM amd64/golang:1.15.7-alpine3.12@sha256:9f88dc7df11a83b9641d71b4be4f8ccbfb2342e5cb733661363ed3d0a98fe3ef AS builder-amd64
|
||||
FROM arm32v7/golang:1.15.7-alpine3.12@sha256:d54bff25a171d1b3036bf6b5dea2bbfaf75b7518e9b780a046750d8e26a19253 AS builder-arm
|
||||
FROM arm64v8/golang:1.15.7-alpine3.12@sha256:e5389316a6dc295d6c0ca269c39124ad5bc9ebb416c71c810822cf6fbcf8ff01 AS builder-arm64
|
||||
FROM builder-${ARCH} AS builder
|
||||
|
||||
ENV FILTRON_VERSION="v0.1.0"
|
||||
|
||||
WORKDIR $GOPATH/src/github.com/asciimoo/filtron
|
||||
|
||||
RUN apk add --no-cache tar="1.32-r1" git="2.26.2-r0" curl="7.69.1-r3" \
|
||||
&& curl -L "https://github.com/asciimoo/filtron/archive/${FILTRON_VERSION}.tar.gz" | tar xvz --strip 1
|
||||
|
||||
RUN go get -d -v && gofmt -l ./ && go build .
|
||||
|
||||
# STEP 2 build the image including only the binary
|
||||
FROM amd64/alpine:3.12.3@sha256:074d3636ebda6dd446d0d00304c4454f468237fdacf08fb0eeac90bdbfa1bac7 AS base-amd64
|
||||
FROM arm32v7/alpine:3.12.3@sha256:299294be8699c1b323c137f972fd0aa5eaa4b95489c213091dcf46ef39b6c810 AS base-arm
|
||||
FROM arm64v8/alpine:3.12.3@sha256:549694ea68340c26d1d85c00039aa11ad835be279bfd475ff4284b705f92c24e AS base-arm64
|
||||
FROM base-${ARCH}
|
||||
|
||||
RUN apk --no-cache add ca-certificates="20191127-r4" \
|
||||
&& adduser -D -h /usr/local/filtron -s /bin/false filtron filtron
|
||||
|
||||
COPY --from=builder /go/src/github.com/asciimoo/filtron/example_rules.json /etc/filtron/rules.json
|
||||
COPY --from=builder /go/src/github.com/asciimoo/filtron/filtron /usr/local/filtron/filtron
|
||||
|
||||
EXPOSE 3000
|
||||
USER filtron
|
||||
|
||||
ENTRYPOINT ["/usr/local/filtron/filtron", "--rules", "/etc/filtron/rules.json"]
|
62
renovate.json
Normal file
62
renovate.json
Normal file
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
"assignees": [
|
||||
"samuel-p"
|
||||
],
|
||||
"baseBranches": [
|
||||
"main"
|
||||
],
|
||||
"rangeStrategy": "bump",
|
||||
"rebaseWhen": "behind-base-branch",
|
||||
"regexManagers": [
|
||||
{
|
||||
"fileMatch": [
|
||||
"^Dockerfile$",
|
||||
"^.drone.yml$"
|
||||
],
|
||||
"matchStrings": [
|
||||
"\\s+ENV\\s*FILTRON_VERSION=\"(?<currentValue>.*?)\"\\s+",
|
||||
"\\s+target:\\s*spcodes\\/filtron:(?<currentValue>.*?)\\s+"
|
||||
],
|
||||
"versioningTemplate": "loose",
|
||||
"depNameTemplate": "asciimoo/filtron",
|
||||
"datasourceTemplate": "github-releases"
|
||||
},
|
||||
{
|
||||
"fileMatch": [
|
||||
"^Dockerfile$"
|
||||
],
|
||||
"matchStrings": [
|
||||
"\\s+(?<depName>[a-z0-9\\-]+?)=\"(?<currentValue>.*?)\""
|
||||
],
|
||||
"lookupNameTemplate": "alpine_3_12/{{{depName}}}",
|
||||
"versioningTemplate": "loose",
|
||||
"datasourceTemplate": "repology"
|
||||
}
|
||||
],
|
||||
"packageRules": [
|
||||
{
|
||||
"datasources": [
|
||||
"github-releases"
|
||||
],
|
||||
"groupName": [
|
||||
"filtron"
|
||||
]
|
||||
},
|
||||
{
|
||||
"datasources": [
|
||||
"repology"
|
||||
],
|
||||
"groupName": [
|
||||
"base dependencies"
|
||||
]
|
||||
},
|
||||
{
|
||||
"datasources": [
|
||||
"docker"
|
||||
],
|
||||
"groupName": [
|
||||
"docker images"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
Reference in a new issue