diff --git a/.drone.yml b/.drone.yml index 80d3e9d..87bccff 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,24 +1,39 @@ -pipeline: - publish: - image: plugins/docker - repo: registry.stuifzandapp.com/microsub-server - registry: registry.stuifzandapp.com - secrets: [ docker_username, docker_password ] +kind: pipeline +name: default - deploy: - image: appleboy/drone-ssh - host: microsub.stuifzandapp.com - username: microsub - secrets: ['ssh_key'] - script: - - cd /home/microsub/microsub - - docker-compose pull web - - docker-compose up -d +workspace: + base: /go + path: src/p83.nl/go/ekster - notify: - image: plugins/webhook - settings: - debug: true - secrets: - - source: result_webhook - target: plugin_urls +steps: + - name: testing + image: golang:1.12-alpine + commands: + - export GOPATH=/go + - export CGO_ENABLED=0 + - apk --no-cache add git + - go get -d -t ./... + - go build p83.nl/go/ekster/cmd/eksterd + - go test ./... + + - name: publish + image: plugins/docker + settings: + repo: registry.stuifzandapp.com/microsub-server + registry: registry.stuifzandapp.com + username: + from_secret: docker_username + password: + from_secret: docker_password + + - name: deploy + image: appleboy/drone-ssh + settings: + host: microsub.stuifzandapp.com + username: microsub + ssh_key: + from_secret: ssh_key + script: + - cd /home/microsub/microsub + - docker-compose pull web + - docker-compose up -d diff --git a/Dockerfile b/Dockerfile index d763319..de0af0a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,7 @@ -# build stage -FROM golang:1.10.2-alpine3.7 AS build-env -RUN apk --no-cache add git -RUN go get p83.nl/go/ekster/... - -# final stage FROM alpine RUN apk --no-cache add ca-certificates -RUN ["mkdir", "-p", "/opt/micropub"] WORKDIR /opt/micropub EXPOSE 80 -COPY --from=build-env /go/bin/eksterd /app/ -RUN ["mkdir", "/app/templates"] -COPY --from=build-env /go/src/p83.nl/go/ekster/templates /app/templates +COPY /go/bin/eksterd /app/ +COPY /go/src/p83.nl/go/ekster/templates /app/templates ENTRYPOINT ["/app/eksterd"] -