build: try create image
This commit is contained in:
parent
2e2cee2ca7
commit
de2f909ed6
@ -6,7 +6,7 @@ on:
|
|||||||
[master, 'release/*']
|
[master, 'release/*']
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_and_deploy:
|
build-and-deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@ -16,13 +16,19 @@ jobs:
|
|||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Log in to Docker Hub
|
- name: Login to Docker Hub
|
||||||
run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Create nuget.config from secret
|
||||||
|
run: echo "${{ secrets.NUGET_CONFIG }}" > nuget.config
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
run: |
|
run: |
|
||||||
docker build --build-arg NUGET_USERNAME=${{ secrets.NUGET_USERNAME }} --build-arg NUGET_PASSWORD=${{ secrets.NUGET_PASSWORD }} -t ${{ secrets.DOCKER_USERNAME }}/mirea-bakend:latest .
|
docker build --build-arg NUGET_USERNAME=${{ secrets.NUGET_USERNAME }} --build-arg NUGET_PASSWORD=${{ secrets.NUGET_PASSWORD }} -t ${{ secrets.DOCKER_USERNAME }}/mirea-backend:latest .
|
||||||
docker push ${{ secrets.DOCKER_USERNAME }}/mirea-bakend:latest
|
docker push ${{ secrets.DOCKER_USERNAME }}/mirea-backend:latest
|
||||||
|
|
||||||
- name: Start ssh-agent
|
- name: Start ssh-agent
|
||||||
id: ssh-agent
|
id: ssh-agent
|
||||||
@ -34,15 +40,15 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
SSH_HOST: ${{ secrets.SSH_HOST }}
|
SSH_HOST: ${{ secrets.SSH_HOST }}
|
||||||
SSH_USER: ${{ secrets.SSH_USER }}
|
SSH_USER: ${{ secrets.SSH_USER }}
|
||||||
DOCKER_IMAGE: ${{ secrets.DOCKER_USERNAME }}/mirea-bakend:latest
|
DOCKER_IMAGE: ${{ secrets.DOCKER_USERNAME }}/mirea-backend:latest
|
||||||
run: |
|
run: |
|
||||||
ssh-keyscan $SSH_HOST >> ~/.ssh/known_hosts
|
ssh-keyscan $SSH_HOST >> ~/.ssh/known_hosts
|
||||||
ssh $SSH_USER@$SSH_HOST "
|
ssh $SSH_USER@$SSH_HOST "
|
||||||
docker pull $DOCKER_IMAGE &&
|
docker pull $DOCKER_IMAGE &&
|
||||||
docker stop mirea-bakend || true &&
|
docker stop mirea-backend || true &&
|
||||||
docker rm mirea-bakend || true &&
|
docker rm mirea-backend || true &&
|
||||||
docker run -d --name mirea-bakend -p 8085:8080 $DOCKER_IMAGE
|
docker run -d --name mirea-backend -p 8085:8080 $DOCKER_IMAGE
|
||||||
"
|
"
|
||||||
|
|
||||||
- name: Remove all keys from ssh-agent
|
- name: Remove all keys from ssh-agent
|
||||||
run: ssh-add -D
|
run: ssh-add -D
|
@ -12,12 +12,12 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
- uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up .NET Core
|
- name: Set up .NET Core
|
||||||
uses: actions/setup-dotnet@v4
|
uses: actions/setup-dotnet@v4
|
||||||
with:
|
with:
|
||||||
dotnet-version: 8.0.x
|
dotnet-version: '8.0.x'
|
||||||
|
|
||||||
- name: Restore dependencies
|
- name: Restore dependencies
|
||||||
run: dotnet restore
|
run: dotnet restore
|
||||||
|
@ -11,8 +11,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Elements of the solution",
|
|||||||
.env = .env
|
.env = .env
|
||||||
.gitattributes = .gitattributes
|
.gitattributes = .gitattributes
|
||||||
.gitignore = .gitignore
|
.gitignore = .gitignore
|
||||||
|
.gitea\workflows\deploy-stage.yaml = .gitea\workflows\deploy-stage.yaml
|
||||||
Dockerfile = Dockerfile
|
Dockerfile = Dockerfile
|
||||||
.gitea\workflows\deploy.yaml = .gitea\workflows\deploy.yaml
|
|
||||||
LICENSE.txt = LICENSE.txt
|
LICENSE.txt = LICENSE.txt
|
||||||
README.md = README.md
|
README.md = README.md
|
||||||
.gitea\workflows\test.yaml = .gitea\workflows\test.yaml
|
.gitea\workflows\test.yaml = .gitea\workflows\test.yaml
|
||||||
|
Loading…
Reference in New Issue
Block a user