Browse Source

Merge branch 'main' of github.com:dtm-labs/dtm

topic
xyctruth 5 years ago
parent
commit
e3cc9f8503
  1. 5
      .github/workflows/release.yml
  2. 3
      helper/Dockerfile-release
  3. 1
      main.go

5
.github/workflows/release.yml

@ -48,6 +48,9 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Get Release Version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v2
with:
@ -57,3 +60,5 @@ jobs:
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
RELEASE_VERSION=${{ env.RELEASE_VERSION }}

3
helper/Dockerfile-release

@ -2,11 +2,12 @@
FROM --platform=$TARGETPLATFORM golang:1.16-alpine as builder
ARG TARGETARCH
ARG TARGETOS
ARG RELEASE_VERSION
WORKDIR /app/dtm
# RUN go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/,direct
EXPOSE 8080
COPY . .
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags="-s -w"
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags="-s -w -X main.Version=$RELEASE_VERSION"
FROM --platform=$TARGETPLATFORM alpine
COPY --from=builder /app/dtm/dtm /app/dtm/

1
main.go

@ -57,6 +57,7 @@ func main() {
version()
return
}
logger.Infof("dtm version is: %s", Version)
config.MustLoadConfig(*confFile)
conf := &config.Config
if *isDebug {

Loading…
Cancel
Save