added some new files
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Samuel Philipp 2021-01-23 23:48:49 +01:00
parent 8ae956c21c
commit 94d17acaa8
4 changed files with 234 additions and 0 deletions

137
.drone.yml Normal file
View 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/morty
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/morty
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/morty
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/morty:v0.1.0
template: spcodes/morty: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/morty
template: spcodes/morty: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
View file

@ -0,0 +1,2 @@
.idea/
*.iml

33
Dockerfile Normal file
View 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 MORTY_VERSION="v0.1.0"
WORKDIR $GOPATH/src/github.com/asciimoo/morty
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/morty/archive/${MORTY_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" \
&& rm -f /var/cache/apk/* \
&& adduser -D -h /usr/local/morty -s /bin/false morty morty
COPY --from=builder /go/src/github.com/asciimoo/morty/morty /usr/local/morty/morty
EXPOSE 3000
USER morty
ENTRYPOINT ["/usr/local/morty/morty"]

62
renovate.json Normal file
View 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*MORTY_VERSION=\"(?<currentValue>.*?)\"\\s+",
"\\s+target:\\s*spcodes\\/morty:(?<currentValue>.*?)\\s+"
],
"versioningTemplate": "loose",
"depNameTemplate": "asciimoo/morty",
"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": [
"morty"
]
},
{
"datasources": [
"repology"
],
"groupName": [
"base dependencies"
]
},
{
"datasources": [
"docker"
],
"groupName": [
"docker images"
]
}
]
}