From 64c096860afff80e0bcc672e514f889aba558f34 Mon Sep 17 00:00:00 2001 From: Luther Wen Xu Date: Tue, 21 Apr 2020 21:32:49 +0800 Subject: [PATCH] Add CI and Dockerfile --- .drone.yml | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 10 ++++++++++ 2 files changed, 58 insertions(+) create mode 100644 .drone.yml create mode 100644 Dockerfile diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..5705e32 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,48 @@ +kind: pipeline +name: Build Application +steps: +- name: Build And Test + image: golang:1.14 + commands: + - go build ./... + - go test ./... + +--- +kind: pipeline +name: Build Docker Image +steps: +- name: Build Docker Image + image: plugins/docker + settings: + registry: docker.teamortix.com + username: droneci + password: + from_secret: docker_password + repo: docker.teamortix.com/teamortix/status + tags: test + purge: true +trigger: + event: + exclude: + - tag +depends_on: + - Build Application + +--- +kind: pipeline +name: Continuous Deployment +steps: +- name: Deploy Docker Image + image: plugins/docker + settings: + registry: docker.teamortix.com + username: droneci + password: + from_secret: docker_password + repo: docker.teamortix.com/teamortix/status + auto_tag: true +trigger: + event: + - tag +depends_on: + - Build Application diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0956bb8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM golang:1.14.2 AS build +WORKDIR /root/ +COPY . . +RUN go build -o Status . + +FROM golang:1.14.2 +WORKDIR /root/ +COPY --from=build /root/Status . +EXPOSE 8080 +CMD ["./ASUBot"]