Skip to content

Commit

Permalink
feat: super make
Browse files Browse the repository at this point in the history
Signed-off-by: Xinwei Xiong(cubxxw-openim) <[email protected]>
  • Loading branch information
cubxxw committed Jul 24, 2023
1 parent 37b9aca commit 15f2433
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 23 deletions.
44 changes: 28 additions & 16 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -273,22 +273,7 @@ dockers:
- --label=io.syncer.image.revision={{.ShortCommit}}
- --label=io.syncer.image.version={{.Tag }}
- --label=io.syncer.image.auth={{ .Env.USERNAME }}
- use: buildx
ids:
- exporter
goos: linux
goarch: amd64
image_templates:
- ghcr.io/{{ .Env.USERNAME }}/exporter:{{ .Tag }}-amd64
dockerfile: deploy/exporter/Dockerfile.exporter
build_flag_templates:
- --pull
- --platform=linux/amd64
- --label=io.exporter.image.created={{.Date}}
- --label=io.exporter.image.title=exporter
- --label=io.exporter.image.revision={{.ShortCommit}}
- --label=io.exporter.image.version={{.Tag }}
- --label=io.exporter.image.auth={{ .Env.USERNAME }}

- use: buildx
ids:
- syncer
Expand All @@ -305,6 +290,24 @@ dockers:
- --label=io.syncer.image.revision={{.ShortCommit}}
- --label=io.syncer.image.version={{.Tag }}
- --label=io.syncer.image.auth={{ .Env.USERNAME }}

- use: buildx
ids:
- exporter
goos: linux
goarch: amd64
image_templates:
- ghcr.io/{{ .Env.USERNAME }}/exporter:{{ .Tag }}-amd64
dockerfile: deploy/exporter/Dockerfile.exporter
build_flag_templates:
- --pull
- --platform=linux/amd64
- --label=io.exporter.image.created={{.Date}}
- --label=io.exporter.image.title=exporter
- --label=io.exporter.image.revision={{.ShortCommit}}
- --label=io.exporter.image.version={{.Tag }}
- --label=io.exporter.image.auth={{ .Env.USERNAME }}

- use: buildx
ids:
- exporter
Expand Down Expand Up @@ -333,6 +336,15 @@ docker_manifests:
- ghcr.io/{{ .Env.USERNAME }}/syncer:{{ .Tag }}-amd64
- ghcr.io/{{ .Env.USERNAME }}/syncer:{{ .Tag }}-arm64

- name_template: ghcr.io/{{ .Env.USERNAME }}/exporter:latest
image_templates:
- ghcr.io/{{ .Env.USERNAME }}/exporter:{{ .Tag }}-amd64
- ghcr.io/{{ .Env.USERNAME }}/exporter:{{ .Tag }}-arm64
- name_template: ghcr.io/{{ .Env.USERNAME }}/syncer:latest
image_templates:
- ghcr.io/{{ .Env.USERNAME }}/syncer:{{ .Tag }}-amd64
- ghcr.io/{{ .Env.USERNAME }}/syncer:{{ .Tag }}-arm64

docker_signs:
- cmd: cosign
artifacts: manifests
Expand Down
9 changes: 5 additions & 4 deletions deploy/exporter/Dockerfile.exporter
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# 设置基础镜像
FROM golang
FROM golang AS builder

# 设置工作目录
WORKDIR /app
Expand All @@ -8,7 +8,8 @@ ENV GOPROXY=https://goproxy.cn

COPY . /app/

RUN go build -o /app/_output/bin/exporter /app/cmd/exporter/main.go
RUN cd /app; go build -o _output/bin/exporter cmd/exporter/main.go

# 设置容器启动命令
CMD ["/app/_output/bin/exporter --help"]
FROM scratch
COPY --from=builder /app/_output/bin/exporter /app
ENTRYPOINT ["/app/exporter --help"]
7 changes: 4 additions & 3 deletions deploy/syncer/Dockerfile.syncer
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# 设置基础镜像
FROM golang
FROM golang AS builder

# 设置工作目录
WORKDIR /app
Expand All @@ -10,5 +10,6 @@ COPY . /app/

RUN go build -o /app/_output/bin/syncer /app/cmd/syncer/main.go

# 设置容器启动命令
CMD ["/app/_output/bin/syncer --help"]
FROM scratch
COPY --from=builder /app/_output/bin/syncer /app
ENTRYPOINT ["/app/syncer --help"]

0 comments on commit 15f2433

Please sign in to comment.