diff --git a/.drone.yml b/.drone.yml index 4d58d642e..b798539a5 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,5 +1,38 @@ --- +publish_pr_tmpl: &publish_pr_tmpl + group: publish + image: plugins/docker + registry: quay.io + tags: + - ${DRONE_PULL_REQUEST} + - ${DRONE_PULL_REQUEST}-${DRONE_BUILD_NUMBER}-${DRONE_COMMIT_SHA} + when: + event: pull_request + secrets: + - source: public_docker_password + target: docker_password + - source: public_docker_username + target: docker_username + +publish_master_tmpl: &publish_master_tmpl + <<: *publish_pr_tmpl + tags: + - latest + - ${DRONE_BUILD_NUMBER}-${DRONE_COMMIT_SHA} + when: + branch: master + event: push + secrets: + - docker_password + - docker_username + +publish_tag_tmpl: &publish_tag_tmpl + <<: *publish_master_tmpl + tags: ${DRONE_TAG} + when: + event: tag + workspace: base: /go path: src/github.com/tinkerbell/tink @@ -7,38 +40,68 @@ workspace: pipeline: test: group: ci - image: golang:1.13-alpine + image: golang:1.13-alpine3.11 commands: - CGO_ENABLED=0 go test -v ./... build: group: ci - image: golang:1.13-alpine + image: golang:1.13-alpine3.11 commands: - - CGO_ENABLED=0 go build + - apk add --update make + - make + + publish_pr_tink-cli: + <<: *publish_pr_tmpl + context: cli/tink + dockerfile: cli/tink/Dockerfile + repo: quay.io/tinkerbell/tink-cli-pr - publish: - group: publish - image: plugins/docker - registry: quay.io + publish_pr_tink-server: + <<: *publish_pr_tmpl repo: quay.io/tinkerbell/tink-pr - tags: - - ${DRONE_BRANCH/\//-} - - ${DRONE_BUILD_NUMBER}-${DRONE_COMMIT_SHA} - when: - event: [push] - secrets: - - source: public_docker_username - target: docker_username - - source: public_docker_password - target: docker_password - - publish_tag: - group: publish - image: plugins/docker - registry: quay.io + context: . + dockerfile: Dockerfile + repo: quay.io/tinkerbell/tink-pr + + publish_pr_tink-worker: + <<: *publish_pr_tmpl + context: worker + dockerfile: worker/Dockerfile + repo: quay.io/tinkerbell/tink-worker-pr + + publish_master_tink-cli: + <<: *publish_master_tmpl + context: cli/tink + dockerfile: cli/tink/Dockerfile + repo: quay.io/tinkerbell/tink-cli + + publish_master_tink-server: + <<: *publish_master_tmpl + context: . + dockerfile: Dockerfile + repo: quay.io/tinkerbell/tink + + publish_master_tink-worker: + <<: *publish_master_tmpl + context: worker + dockerfile: worker/Dockerfile + repo: quay.io/tinkerbell/tink-worker + + publish_tag_tink-cli: + <<: *publish_tag_tmpl + context: cli/tink + dockerfile: cli/tink/Dockerfile + repo: quay.io/tinkerbell/tink-cli + + publish_tag_tink-server: + <<: *publish_tag_tmpl + context: . + dockerfile: Dockerfile repo: quay.io/tinkerbell/tink - tags: ${DRONE_TAG} - when: - event: [tag] - secrets: [docker_username, docker_password] + + publish_tag_tink-worker: + <<: *publish_tag_tmpl + context: worker + dockerfile: worker/Dockerfile + repo: quay.io/tinkerbell/tink-worker diff --git a/Dockerfile b/Dockerfile index 044cd02fc..bbb378a28 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,12 @@ -FROM golang:1.13-alpine +FROM alpine:3.11 +ENTRYPOINT ["tink-server"] EXPOSE 42113 EXPOSE 42114 -WORKDIR /go/src/app - -COPY . . - -RUN apk update && \ - apk add ca-certificates postgresql-client && \ - apk add --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing cfssl && \ - go build -o /go/bin/tink-server . +RUN apk add --update ca-certificates && \ + apk add --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing cfssl COPY deploy/migrate /migrate COPY deploy/docker-entrypoint-initdb.d/tinkerbell-init.sql /init.sql - -ENTRYPOINT ["tink-server"] +COPY tink-server /bin/ diff --git a/cli/tink/Dockerfile b/cli/tink/Dockerfile index 2d03b37e6..bf6c38ed8 100644 --- a/cli/tink/Dockerfile +++ b/cli/tink/Dockerfile @@ -1,7 +1,8 @@ -FROM alpine:3.7 +FROM alpine:3.11 -CMD sleep 60d +CMD sleep infinity RUN apk add --no-cache --update --upgrade ca-certificates + COPY tink-cli /bin/tink COPY sample.tmpl /tmp diff --git a/tls/Dockerfile b/tls/Dockerfile index 277aa3d09..3162c8a98 100644 --- a/tls/Dockerfile +++ b/tls/Dockerfile @@ -1,6 +1,7 @@ -FROM alpine:3.7 +FROM alpine:3.11 ENTRYPOINT [ "/entrypoint.sh" ] -COPY . . + RUN apk add --no-cache --update --upgrade ca-certificates postgresql-client RUN apk add --no-cache --update --upgrade --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing cfssl +COPY . . diff --git a/worker/Dockerfile b/worker/Dockerfile index e6da2f0ba..e264c2c8f 100644 --- a/worker/Dockerfile +++ b/worker/Dockerfile @@ -1,5 +1,7 @@ -FROM alpine:3.10 +FROM alpine:3.11 + +ENTRYPOINT [ "/tink-worker" ] RUN apk add --no-cache --update --upgrade ca-certificates + COPY tink-worker /tink-worker -ENTRYPOINT [ "/tink-worker" ]