-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (48 loc) · 1.49 KB
/
docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# 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