add Docker file wih drone pipeline

This commit is contained in:
OCram85 2021-12-23 14:26:58 +01:00
parent 3c93f9f739
commit 48c26cf822
2 changed files with 115 additions and 0 deletions

102
.drone.yml Normal file
View File

@ -0,0 +1,102 @@
---
kind: pipeline
type: docker
name: "Test Pipeline"
trigger:
event:
exclude:
- tag
steps:
- name: "Hugo test build"
image: klakegg/hugo:0.91.0-ext-ubuntu
commands:
- hugo --fgc --minify
---
kind: pipeline
type: docker
name: "Next Build Pipeline"
trigger:
event:
exclude:
- pull_request
branch:
exclude:
- master
depends_on:
- "Test Pipeline"
steps:
- name: "Build (${DRONE_BRANCH} as next)"
image: plugins/docker
settings:
username:
from_secret: hub_user
password:
from_secret: hub_passwd
repo: ocram85/blog
tags: "next"
dockerfile: Dockerfile
- name: "Trivy (next)"
image: aquasec/trivy
commands:
- "trivy image ocram85/blog:next"
---
kind: pipeline
type: docker
name: "Master Build Pipeline"
trigger:
event:
exclude:
- pull_request
- tag
branch:
include:
- master
depends_on:
- "Test Pipeline"
steps:
- name: "Build (master)"
image: plugins/docker
settings:
username:
from_secret: hub_user
password:
from_secret: hub_passwd
repo: ocram85/blog
auto_tag: true
dockerfile: Dockerfile
- name: "Trivy (latest)"
image: aquasec/trivy
commands:
- "trivy image ocram85/blog:latest"
---
kind: pipeline
type: docker
name: "Tags Pipeline"
trigger:
event:
include:
- tag
steps:
- name: "Build tag image"
image: plugins/docker
settings:
username:
from_secret: hub_user
password:
from_secret: hub_passwd
repo: ocram85/blog
auto_tag: true

13
Dockerfile Normal file
View File

@ -0,0 +1,13 @@
FROM klakegg/hugo:0.91.0-ext-ubuntu as builder
COPY . /src
#RUN ls -la
WORKDIR /src
#RUN ls -a
RUN hugo --gc --minify
FROM caddy:2.4.5-alpine
LABEL maintainer="marco.blessing@googlemail.com"
COPY --from=builder src/public /usr/share/caddy/
HEALTHCHECK --interval=15s --timeout=3s \
CMD wget --no-verbose --tries=1 --spider http://localhost:80/ || exit 1
#RUN ls -la /usr/share/caddy/