Skip to content

Commit

Permalink
feat: support upload docker image to ghci (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
sysulq authored Oct 8, 2022
1 parent 651163e commit 1607aef
Show file tree
Hide file tree
Showing 5 changed files with 135 additions and 72 deletions.
31 changes: 29 additions & 2 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
tags:
- "v**"

env:
REGISTRY: ghcr.io
IMAGE_NAME: juno-agent

jobs:
goreleaser:
runs-on: ubuntu-latest
Expand All @@ -31,6 +35,29 @@ jobs:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
version: latest
args: release --rm-dist
args: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to the Container registry
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: image_name
run: echo ${{ env.IMAGE_NAME }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: mr-smithers-excellent/[email protected]
with:
registry: ${{ env.REGISTRY }}
image: ${{ env.IMAGE_NAME }}
addLatest: true
dockerfile: Dockerfile
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
31 changes: 29 additions & 2 deletions .github/workflows/latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ name: goreleaser
on:
push:
branches:
- master
- "*"

env:
REGISTRY: ghcr.io
IMAGE_NAME: juno-agent

jobs:
goreleaser:
Expand Down Expand Up @@ -31,10 +35,33 @@ jobs:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
version: latest
args: release --rm-dist
args: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v2
with:
name: my-artifact
path: dist/*_linux_amd64.tar.gz
- name: Log in to the Container registry
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: image_name
run: echo ${{ env.IMAGE_NAME }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: mr-smithers-excellent/[email protected]
with:
registry: ${{ env.REGISTRY }}
image: ${{ env.IMAGE_NAME }}
addLatest: false
dockerfile: Dockerfile
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
26 changes: 14 additions & 12 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
project_name: juno-agent

builds:
- main: ./cmd/juno-agent
id: "juno-agent"
binary: juno-agent
goos:
- linux
- darwin
- windows
goarch: [amd64]
ldflags:
- -X github.com/douyu/jupiter/pkg.buildAppVersion={{.Version}}
- -X github.com/douyu/jupiter/pkg.buildTime={{.Date}}
- -X github.com/douyu/jupiter/pkg.buildUser=goreleaser
- main: ./cmd/juno-agent
id: juno-agent
binary: juno-agent
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
- windows
goarch: [amd64]
ldflags:
- -X github.com/douyu/jupiter/pkg.buildAppVersion={{.Version}}
- -X github.com/douyu/jupiter/pkg.buildTime={{.Date}}
- -X github.com/douyu/jupiter/pkg.buildUser=goreleaser
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM alpine:latest

WORKDIR /app
COPY dist/juno-agent_linux_amd64_v1/juno-agent /app/bin/
COPY config /app/config

CMD ["/app/bin/juno-agent", "--config", "/app/config/config.toml"]
112 changes: 56 additions & 56 deletions config/config.toml
Original file line number Diff line number Diff line change
@@ -1,91 +1,91 @@
[plugin]

[plugin.regProxy]
enable = true
[plugin.regProxy]
enable = true

[plugin.regProxy.prometheus]
enable = true
path = "/home/www/system/prometheus/conf"
enableZone = true
zones = ["HB-WHYL"] # 用于支持zone过滤
enableCleanup = true
timeInterval = 10
[plugin.regProxy.prometheus]
enable = true
path = "/home/www/system/prometheus/conf"
enableZone = true
zones = ["HB-WHYL"] # 用于支持zone过滤
enableCleanup = false
timeInterval = 10

[plugin.confProxy]
# 配置中心地址
env = ["dev", "live", "pre"]
prefix = "/juno-agent"
timeout = "3s"
enable = true

#配置中心数据源
[plugin.confProxy.mysql]
enable = false
dsn = ""
secure = false
# 配置中心地址
env = ["dev", "live", "pre"]
prefix = "/juno-agent"
timeout = "3s"
enable = true

#配置中心数据源
[plugin.confProxy.mysql]
enable = false
dsn = ""
secure = false

[plugin.supervisor]
enable = true
dir = "/etc/supervisor/conf.d"
enable = true
dir = "/etc/supervisor/conf.d"

[plugin.systemd]
enable = true
dir = "/etc/systemd/system"
enable = true
dir = "/etc/systemd/system"

[plugin.nginx]
enable = false
dir = "/usr/local/openresty/nginx/conf"
enable = false
dir = "/usr/local/openresty/nginx/conf"

[plugin.report]
enable = true
debug = true
addr = "http://127.0.0.1:50000/api/v1/resource/node/heartbeat"
internal = "60s"
hostName = "JUNO_HOST" # 环境变量的名称,或者命令行参数的名称
regionCode = "REGION_CODE" # 环境变量的名称,或者命令行参数的名称
regionName = "REGION_NAME"
zoneCode = "ZONE_CODE"
zoneName = "ZONE_NAME"
env = "ENV"
enable = true
debug = true
addr = "http://127.0.0.1:50002/api/v1/resource/node/heartbeat"
internal = "60s"
hostName = "JUNO_HOST" # 环境变量的名称,或者命令行参数的名称
regionCode = "REGION_CODE" # 环境变量的名称,或者命令行参数的名称
regionName = "REGION_NAME"
zoneCode = "ZONE_CODE"
zoneName = "ZONE_NAME"
env = "ENV"

[plugin.healthCheck]
enable = false
enable = false

[plugin.process]
enable = false
enable = false

[plugin.worker]
enable = false
reqTimeout = 10
enable = false
reqTimeout = 10

# service registry etcd
[jupiter.etcdv3.register]
endpoints = ["etcd-naming.dz11.com:2379"]
connectTimeout = "10s"
endpoints = ["http://127.0.0.1:2379"]
connectTimeout = "3s"

# default etcd (config-publish / cronjob-dispatch / etc...)
[jupiter.etcdv3.default]
endpoints = ["etcd-naming.dz11.com:2379"]
connectTimeout = "10s"
endpoints = ["http://127.0.0.1:2379"]
connectTimeout = "3s"

[jupiter.logger.default]
name = "default"
debug = true
name = "default"
debug = true

[jupiter.logger.cronjob]
name = "cronjob.log"
level = "debug"
name = "cronjob.log"
level = "debug"

[jupiter.server]

[jupiter.server.grpc]
host = "0.0.0.0"
port = 60813
[jupiter.server.grpc]
host = "0.0.0.0"
port = 60813

[jupiter.server.http]
host = "0.0.0.0"
port = 50010
[jupiter.server.http]
host = "0.0.0.0"
port = 50010

[api]
# 密钥长度需要为32位
secret = "j1Sblr5uiJtuCQLsT89BRqtAgWDO2anI"
# 密钥长度需要为32位
secret = "j1Sblr5uiJtuCQLsT89BRqtAgWDO2anI"

0 comments on commit 1607aef

Please sign in to comment.