update code
This commit is contained in:
39
.gitlab-ci.yaml
Normal file
39
.gitlab-ci.yaml
Normal file
@@ -0,0 +1,39 @@
|
||||
stages:
|
||||
- generate_image
|
||||
- deploy
|
||||
|
||||
variables:
|
||||
BUILD_NAME: "go/ddns"
|
||||
SERVICE_NAME: "ddns"
|
||||
IMAGE_TAG: "latest"
|
||||
|
||||
generate_image_dev:
|
||||
variables:
|
||||
IMAGE_TAG: dev
|
||||
stage: generate_image
|
||||
image: docker:20.10.2
|
||||
script:
|
||||
- docker build -t $BUILD_NAME:$IMAGE_TAG .
|
||||
tags:
|
||||
- '001'
|
||||
only:
|
||||
- dev
|
||||
except:
|
||||
- triggers
|
||||
|
||||
deploy_dev:
|
||||
stage: deploy
|
||||
image: docker:20.10.2
|
||||
script:
|
||||
- CONTAINER_NAME=$(docker ps -aq --filter name=$SERVICE_NAME)
|
||||
- echo $CONTAINER_NAME
|
||||
- if [[ -n "$CONTAINER_NAME" ]]; then
|
||||
docker rm -f $CONTAINER_NAME;
|
||||
fi
|
||||
- docker run -d --name $SERVICE_NAME $BUILD_NAME:$IMAGE_TAG
|
||||
tags:
|
||||
- '001'
|
||||
only:
|
||||
- dev
|
||||
except:
|
||||
- triggers
|
10
Dockerfile
10
Dockerfile
@@ -1,7 +1,15 @@
|
||||
FROM golang:latest as builder
|
||||
ENV GOPROXY https://goproxy.io,direct
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
RUN go build -o ddns
|
||||
|
||||
|
||||
|
||||
FROM alpine:latest
|
||||
MAINTAINER Eirf
|
||||
ENV VERSION 1.0
|
||||
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
COPY --from=builder /app/ddns /app/ddns
|
||||
CMD ["/app/ddns"]
|
||||
|
@@ -1,14 +0,0 @@
|
||||
FROM golang:builder as builder
|
||||
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
RUN go build -o ddns
|
||||
|
||||
|
||||
FROM golang:runner
|
||||
MAINTAINER Eirf
|
||||
ENV VERSION 1.0
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=builder /app/ddns /app/ddns
|
||||
CMD ["/app/ddns"]
|
2
go.mod
2
go.mod
@@ -3,6 +3,7 @@ module client
|
||||
go 1.17
|
||||
|
||||
require (
|
||||
github.com/PuerkitoBio/goquery v1.8.0
|
||||
github.com/alibabacloud-go/alidns-20150109/v2 v2.0.1
|
||||
github.com/alibabacloud-go/darabonba-env v1.0.0
|
||||
github.com/alibabacloud-go/darabonba-openapi v0.1.1
|
||||
@@ -12,7 +13,6 @@ require (
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/PuerkitoBio/goquery v1.8.0 // indirect
|
||||
github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 // indirect
|
||||
github.com/alibabacloud-go/endpoint-util v1.1.0 // indirect
|
||||
github.com/alibabacloud-go/openapi-util v0.0.6 // indirect
|
||||
|
Reference in New Issue
Block a user