From 300233e968ab34e4c659464c77524bc56bd705a6 Mon Sep 17 00:00:00 2001 From: Peter Stuifzand Date: Sat, 16 Mar 2019 20:25:18 +0100 Subject: [PATCH] Rewrite for Drone 1.0 --- .drone.yml | 60 ++++++++++++++++++++++++++++++++++-------------------- Dockerfile | 12 ++--------- 2 files changed, 40 insertions(+), 32 deletions(-) diff --git a/.drone.yml b/.drone.yml index ca6cadd..d35dde6 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,24 +1,40 @@ -pipeline: - publish: - image: plugins/docker - repo: registry.stuifzandapp.com/wiki - registry: registry.stuifzandapp.com - secrets: [ docker_username, docker_password ] - deploy: - image: appleboy/drone-ssh - host: wiki.p83.nl - username: wiki - secrets: ['ssh_key'] - script: - - cd /home/wiki/wiki - - docker-compose pull web - - docker-compose up -d +kind: pipeline +name: default - notify: - image: plugins/webhook - settings: - debug: true - secrets: - - source: result_webhook - target: plugin_urls +steps: + - name: testing + commands: + - go get -u ./... + - go build -u ./... + - go test ./... + + - name: publish + image: plugins/docker + settings: + repo: registry.stuifzandapp.com/wiki + registry: registry.stuifzandapp.com + username: + from_secret: docker_username + password: + from_secret: docker_password + + - name: deploy + image: appleboy/drone-ssh + settings: + host: wiki.p83.nl + username: wiki + ssh_key: + from_secret: ssh_key + script: + - cd /home/wiki/wiki + - docker-compose pull web + - docker-compose up -d + + - name: notify + image: plugins/webhook + settings: + debug: true + secrets: + - source: result_webhook + target: plugin_urls diff --git a/Dockerfile b/Dockerfile index cdf83ae..97fd488 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,8 @@ -# build stage -FROM golang:1.10.2-alpine3.7 AS build-env -RUN apk --no-cache add git -RUN go get -u p83.nl/go/wiki/... -RUN go test p83.nl/go/wiki/... - -# final stage FROM alpine RUN apk --no-cache add ca-certificates git RUN adduser --disabled-password --uid 1005 wiki EXPOSE 80 -COPY --from=build-env /go/bin/wiki /app/ -RUN ["mkdir", "/app/templates"] -COPY --from=build-env /go/src/p83.nl/go/wiki/templates /app/templates WORKDIR /app +ADD ./wiki /app +ADD ./templates /app/templates ENTRYPOINT ["/app/wiki"]