From 12aea9c9e1eb7369f15bc379da253ff3712f4f03 Mon Sep 17 00:00:00 2001 From: Jay Date: Fri, 3 May 2019 21:54:27 +0800 Subject: [PATCH 1/6] add ci file --- .drone.yml | 16 ++++++++++++++++ README.md | 3 +++ 2 files changed, 19 insertions(+) create mode 100644 .drone.yml create mode 100644 README.md diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..1e2811f --- /dev/null +++ b/.drone.yml @@ -0,0 +1,16 @@ +kind: pipeline +name: default + +setps: + - name: build image + image: plugin/docker + settings: + registry: docker.mtfos.xyz + repo: docker.mtfos.xyz/mtfos/aws-ddns + tags: + - latest + - ${DRONE_COMMIT} + +trigger: + branch: + - master \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..c6eb9c9 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +## Golang AWS DDNS Service + +[![Build Status](https://ci.trj.tw/api/badges/golang/go-ddns-svc/status.svg)](https://ci.trj.tw/golang/go-ddns-svc) From 02a89d5c38c830f62be9246f4a72e4549d2aafa8 Mon Sep 17 00:00:00 2001 From: Jay Date: Fri, 3 May 2019 21:56:06 +0800 Subject: [PATCH 2/6] fix ci --- .drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 1e2811f..3175491 100644 --- a/.drone.yml +++ b/.drone.yml @@ -2,8 +2,8 @@ kind: pipeline name: default setps: - - name: build image - image: plugin/docker + - name: 'build image' + image: plugins/docker settings: registry: docker.mtfos.xyz repo: docker.mtfos.xyz/mtfos/aws-ddns From e4205f68abd62d4ba60ce62c61782b551514cd18 Mon Sep 17 00:00:00 2001 From: Jay Date: Fri, 3 May 2019 21:57:20 +0800 Subject: [PATCH 3/6] fix ci config --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 3175491..cb98835 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,7 +1,7 @@ kind: pipeline name: default -setps: +steps: - name: 'build image' image: plugins/docker settings: From 729fbc45a221400d1d6ccd052522c8640cacb063 Mon Sep 17 00:00:00 2001 From: Jay Date: Fri, 3 May 2019 22:03:55 +0800 Subject: [PATCH 4/6] add build file --- Dockerfile | 13 +++++++++++++ Makefile | 7 +++++++ 2 files changed, 20 insertions(+) create mode 100644 Dockerfile create mode 100644 Makefile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1cbe39b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM golang:1.12-alpine as builder +WORKDIR /data +COPY . . +RUN apk add --no-cache make git ca-certificates \ + make + +FROM alpine:latest +RUN apk add --no-cache ca-certificates +WORKDIR /data +COPY --from=stage /data/ddns-svc /usr/bin +COPY config.default.yml config.yml +EXPOSE 10230 +CMD ["/usr/bin/ddns-svc", "-f", "/data/config.yml"] \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9d74206 --- /dev/null +++ b/Makefile @@ -0,0 +1,7 @@ +.PHONY: clean build + +build: + GOOS=linux go build -o ddns-svc -ldflags "-s -w" . + +clean: + rm -rf ddns-svc && go clean \ No newline at end of file From 5a987f98f4c2c69e0eb82b68f1a12097d8d94653 Mon Sep 17 00:00:00 2001 From: Jay Date: Fri, 3 May 2019 22:05:47 +0800 Subject: [PATCH 5/6] fix dockerfile error --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 1cbe39b..eb3dc5b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ RUN apk add --no-cache make git ca-certificates \ FROM alpine:latest RUN apk add --no-cache ca-certificates WORKDIR /data -COPY --from=stage /data/ddns-svc /usr/bin +COPY --from=builder /data/ddns-svc /usr/bin COPY config.default.yml config.yml EXPOSE 10230 CMD ["/usr/bin/ddns-svc", "-f", "/data/config.yml"] \ No newline at end of file From fbce57d7429484e2171a6fbd0d04c97475b6167f Mon Sep 17 00:00:00 2001 From: Jay Date: Fri, 3 May 2019 22:10:37 +0800 Subject: [PATCH 6/6] fix dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index eb3dc5b..c3e5fff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM golang:1.12-alpine as builder WORKDIR /data COPY . . -RUN apk add --no-cache make git ca-certificates \ +RUN apk add --no-cache make git ca-certificates && \ make FROM alpine:latest