Subscriptions in Web #127
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
# This workflow will build a .NET project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net | |
name: Dockerize Project | |
on: | |
push: | |
branches: [ "dev" ] | |
paths: | |
- 'src/server/**' | |
pull_request: | |
branches: [ "dev" ] | |
paths: | |
- 'src/server/**' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore dependencies | |
run: dotnet restore src/server/CookingApp/CookingApp.csproj | |
- name: Build | |
run: dotnet build src/server/CookingApp/CookingApp.csproj --no-restore | |
- name: Test | |
run: dotnet test src/server/CookingApp/CookingApp.csproj --no-build --verbosity normal | |
push_to_registry: | |
name: Push Docker image to Docker Hub | |
runs-on: ubuntu-latest | |
needs: build | |
env: | |
working-directory: src/server/CookingApp | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Log in to Docker Hub | |
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: src/server/CookingApp | |
file: src/server/CookingApp/Dockerfile | |
push: true | |
tags: ${{secrets.DOCKER_USERNAME}}/cookingapp |