-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from Eric-Jalal/develop
Update flow and enhance dockerfile
- Loading branch information
Showing
3 changed files
with
52 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,10 +21,33 @@ jobs: | |
uses: mathieudutour/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build release version | ||
run: | | ||
cmake . && make | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
push: true | ||
build-args: GIT_COMMIT=${{ github.sha }} | ||
tags: jerilok/cpp-build-test:latest | ||
|
||
# This is an unofficial action and could be internilized and be recreated due to security reasons in enterprise companies. | ||
- name: Create a GitHub release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
tag: ${{ steps.tag_version.outputs.new_tag }} | ||
name: Release ${{ steps.tag_version.outputs.new_tag }} | ||
body: ${{ steps.tag_version.outputs.changelog }} | ||
artifacts: "/usr/src/app/main" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
FROM gcc:9.5.0 | ||
FROM gcc:9.5.0 as builder | ||
|
||
ARG GIT_COMMIT=unspecified | ||
LABEL org.mybigcompany=$GIT_COMMIT | ||
LABEL build.org.mybigcompany=$GIT_COMMIT | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY . . | ||
|
||
RUN apt-get update && apt-get install -y cmake lcov | ||
RUN apt-get update && apt-get install -y cmake | ||
|
||
RUN cmake . && make | ||
|
||
CMD ["./main"] | ||
FROM debian:buster-slim | ||
|
||
COPY --from=builder /usr/src/app/main /usr/app/main | ||
|
||
WORKDIR /usr/app | ||
|
||
CMD ["./main"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters