Skip to content

Commit

Permalink
review docker-build to include go pseudohash and version
Browse files Browse the repository at this point in the history
  • Loading branch information
sduchesneau committed Dec 11, 2023
1 parent a7b22cf commit 91d53e8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ on:
tags:
- "v*"
branches:
- "block_any"
- "develop"
- "stepdtest"
workflow_dispatch:

env:
Expand Down Expand Up @@ -37,11 +38,11 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Get repo name
id: extract_repo_name
- name: Get go pseudohash
id: extract_pseudohash
shell: bash
run: |
echo "REPO_NAME=$(basename ${{ github.repository }})" >> $GITHUB_ENV
echo "GO_PSEUDOHASH=$(go list -f '{{.Version}}' -m github.com/streamingfast/firehose-core@${{ github.sha }})" > $GITHUB_ENV
- name: Generate docker tags/labels from github build context
id: meta
Expand All @@ -51,6 +52,7 @@ jobs:
tags: |
type=ref,event=tag
type=sha,prefix=,enable=true
type=raw,value=${{ env.GO_PSEUDOHASH }}
type=raw,enable=${{ github.ref == 'refs/heads/develop' }},value=develop
flavor: |
latest=${{ startsWith(github.ref, 'refs/tags/') }}
Expand All @@ -59,6 +61,8 @@ jobs:
uses: docker/build-push-action@v4
with:
context: .
build-args: |
VERSION=${{ github.event.ref }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand All @@ -75,4 +79,4 @@ jobs:
uses: Ilshidur/[email protected]
with:
args: |
:done: *${{ github.repository }}* Success building docker image from ${{ github.ref_type }} _${{ github.ref_name }}_ (${{ github.actor }}) :sparkling_heart: ```${{ join(needs.build.outputs.tags, ' ') }}```
:done: *${{ github.repository }}* Success building docker image from ${{ github.ref_type }} _${{ github.ref_name }}_ (${{ github.actor }}) :sparkling_heart: ```${{ join(needs.build.outputs.tags, ' ') }}```
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN go mod download

COPY . ./

RUN go build ./cmd/firecore
RUN go build -v -ldflags "-X main.version=${VERSION}" ./cmd/firecore

####

Expand All @@ -23,4 +23,4 @@ WORKDIR /app

COPY --from=build /app/firecore /app/firecore

ENTRYPOINT [ "/app/firecore" ]
ENTRYPOINT [ "/app/firecore" ]
Binary file added firecore
Binary file not shown.

0 comments on commit 91d53e8

Please sign in to comment.