Skip to content

Commit

Permalink
fix: include commit hash when building on GitHub
Browse files Browse the repository at this point in the history
Signed-off-by: Matej Focko <[email protected]>
  • Loading branch information
mfocko committed Apr 4, 2023
1 parent b349d3d commit 094d60a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
unique_tag="${branch}-${GITHUB_SHA::7}"
echo "tag=${tag} ${unique_tag}" >> $GITHUB_OUTPUT
echo "api=${api}" >> $GITHUB_OUTPUT
echo "commit_sha=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
id: branch_tag

- name: Build Image
Expand All @@ -49,7 +50,7 @@ jobs:
dockerfiles: ${{ matrix.dockerfile }}
image: ${{ matrix.image }}
tags: ${{ steps.branch_tag.outputs.tag }}
build-args: REACT_APP_API_URL=${{ steps.branch_tag.outputs.api }}
build-args: REACT_APP_API_URL=${{ steps.branch_tag.outputs.api }} REACT_APP_GIT_SHA=${{ steps.branch_tag.outputs.commit_sha }}
oci: true

- name: Push To Quay
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ FROM quay.io/packit/base
ARG REACT_APP_API_URL=https://stg.packit.dev/api
ENV REACT_APP_API_URL ${REACT_APP_API_URL}

ARG REACT_APP_GIT_SHA=dev
ENV REACT_APP_GIT_SHA ${REACT_APP_GIT_SHA}

ENV HOME=/home/packit_dashboard

WORKDIR /src
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ run-container-stg: build-stg
build-stg:
$(CONTAINER_ENGINE) build --rm \
--build-arg REASCT_APP_API_URL=$(API_STG) \
--build-arg GIT_SHA=$(GIT_SHA) \
--build-arg REACT_APP_GIT_SHA=$(GIT_SHA) \
-t $(IMAGE) -f Dockerfile .

push-stg: build-stg
Expand Down

0 comments on commit 094d60a

Please sign in to comment.