fix: remove definition of port on dockefile #39
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
name: .NET | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: | |
name: actions_back_front_orange_finance | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Semantic Release | |
id: semantic_release | |
uses: cycjimmy/semantic-release-action@v4 | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
- name: Get latest tag as build name | |
id: get_version_number | |
run: | | |
git_tag=$(git describe --abbrev=0 --tags) | |
git_tag_sub=${git_tag:1} | |
echo "Build number: $git_tag_sub" | |
echo "version_number=$git_tag_sub" >> $GITHUB_ENV | |
- name: Echo the version number | |
run: | | |
echo "The version number is: ${{ env.version_number }}" | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.x | |
- name: Restore dependencies | |
run: dotnet restore Back-Orange-Finance/Orange-Finance/OrangeFinance.csproj | |
- name: Build application | |
run: dotnet build Back-Orange-Finance/Orange-Finance/OrangeFinance.csproj --no-restore --configuration Release | |
- name: Publish application | |
run: dotnet publish Back-Orange-Finance/Orange-Finance/OrangeFinance.csproj --no-build --configuration Release -o out | |
- name: Log in to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: Back-Orange-Finance | |
file: Back-Orange-Finance/Orange-Finance/Dockerfile | |
push: true | |
tags: ${{ secrets.DOCKER_USERNAME }}/orange-finance-backend:${{ env.version_number }} | |
- name: Scan Docker image for vulnerabilities | |
uses: aquasecurity/[email protected] | |
with: | |
image-ref: ${{ secrets.DOCKER_USERNAME }}/orange-finance-backend:${{ env.version_number }} |