Skip to content

Commit

Permalink
add(gha) dockerfile, images
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalyu committed Aug 7, 2024
1 parent 3910b54 commit ae1811b
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build-and-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ jobs:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags')
steps:
- name: Login to GitHub Container Registry
uses: docker/#-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@v4
with:
Expand Down
28 changes: 28 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,31 @@ archives:

checksum:
name_template: "checksums.txt"

dockers:
- image_templates:
- "ghcr.io/vitalyu/{{ .ProjectName }}:{{ .Version }}-amd64"
goarch: amd64
dockerfile: Dockerfile
use: buildx
build_flag_templates:
- --platform=linux/amd64

- image_templates:
- "ghcr.io/vitalyu/{{ .ProjectName }}:{{ .Version }}-arm64"
goarch: arm64
dockerfile: Dockerfile
use: buildx
build_flag_templates:
- --platform=linux/arm64/v8

docker_manifests:
- name_template: "ghcr.io/vitalyu/{{ .ProjectName }}:{{ .Version }}"
image_templates:
- "ghcr.io/vitalyu/{{ .ProjectName }}:{{ .Version }}-amd64"
- "ghcr.io/vitalyu/{{ .ProjectName }}:{{ .Version }}-arm64"

- name_template: "ghcr.io/vitalyu/{{ .ProjectName }}:latest"
image_templates:
- "ghcr.io/vitalyu/{{ .ProjectName }}:{{ .Version }}-amd64"
- "ghcr.io/vitalyu/{{ .ProjectName }}:{{ .Version }}-arm64"
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM golang:1.22-alpine AS builder
WORKDIR /app
COPY . .
RUN go build -o prometheus-fake-remote-read ./cmd/prometheus-fake-remote-read

FROM alpine:latest
WORKDIR /root/

COPY --from=builder /app/prometheus-fake-remote-read .
COPY --from=builder /app/configs/example.config.json .

ENTRYPOINT [ "./prometheus-fake-remote-read" ]
CMD [ "--config", "./example.config.json" ]

0 comments on commit ae1811b

Please # to comment.