Skip to content
This repository has been archived by the owner on Feb 9, 2020. It is now read-only.

Commit

Permalink
Add PKI provider Docker plugin configuration and build configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
janartodesk committed Aug 28, 2019
1 parent e1e8661 commit 9eeb15d
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
example/
config.json
Dockerfile
README.md
tusk.yml
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM golang:1.12-alpine AS builder

ENV GO111MODULE=on

RUN apk add --no-cache git gcc libc-dev

COPY . /go/src/github.com/sendsmaily/docker-secretprovider-pki

WORKDIR /go/src/github.com/sendsmaily/docker-secretprovider-pki

RUN set -ex && go install --ldflags '-extldflags "-static"'


FROM alpine:latest

RUN apk add --no-cache ca-certificates

COPY --from=builder /go/bin/docker-secretprovider-pki .

CMD ["docker-secretprovider-pki"]
47 changes: 47 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"description": "PKI secrets plugin",
"documentation": "https://github.com/sendsmaily",
"env": [
{
"name": "BACKEND",
"description": "PKI provider backend to use",
"settable": [
"value"
],
"value": "test"
}
],
"entrypoint": [
"/docker-secretprovider-pki"
],
"mounts": [
{
"destination": "/secrethub",
"source": "/etc/docker/secrethub",
"options": [
"rbind"
],
"type": "bind"
},
{
"destination": "/docker.sock",
"source": "/run/docker.sock",
"options": [
"rbind"
],
"type": "bind"
}
],
"network": {
"type": "host"
},
"interface": {
"types": [
"docker.secretprovider/1.0"
],
"socket": "plugin.sock"
},
"linux": {
"capabilities": []
}
}
37 changes: 37 additions & 0 deletions tusk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
tasks:
set-environment:
private: true
options:
build-tag:
default:
command: git log -1 --pretty=%h ./
run:
- set-environment:
BUILD_TAG: ${build-tag}

build.plugin:
usage: Build the PKI plugin
run:
- task: set-environment
# Clean up.
- command: rm -rf ./plugin
# Build the plugin, then extract the created filesystem from the image
# into `./plugin/rootfs` directory.
- command: docker build -t sendsmaily/docker-secretprovider-pki:rootfs .
- command: mkdir -p ./plugin/rootfs
- command: docker create --name sendsmaily-pki-rootfs sendsmaily/docker-secretprovider-pki:rootfs
- command: docker export sendsmaily-pki-rootfs | tar -xC ./plugin/rootfs
- command: docker rm -vf sendsmaily-pki-rootfs
# Copy over configuration file needed to run the plugin.
- command: cp config.json ./plugin/
# Then create the plugin from created file system.
- command: docker plugin rm -f sendsmaily/docker-secretprovider-pki:${BUILD_TAG} || true
- command: docker plugin create sendsmaily/docker-secretprovider-pki:${BUILD_TAG} ./plugin

publish.plugin:
usage: Publish the PKI plugin on Docker Hub
run:
- task: set-environment
- command: docker plugin push sendsmaily/docker-secretprovider-pki:${BUILD_TAG}
- command: docker plugin push sendsmaily/docker-secretprovider-pki:latest

0 comments on commit 9eeb15d

Please sign in to comment.