build: try create image
This commit is contained in:
parent
2e2cee2ca7
commit
de2f909ed6
@ -6,7 +6,7 @@ on:
|
||||
[master, 'release/*']
|
||||
|
||||
jobs:
|
||||
build_and_deploy:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
@ -17,12 +17,18 @@ jobs:
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- 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
|
||||
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 push ${{ 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-backend:latest
|
||||
|
||||
- name: Start ssh-agent
|
||||
id: ssh-agent
|
||||
@ -34,14 +40,14 @@ jobs:
|
||||
env:
|
||||
SSH_HOST: ${{ secrets.SSH_HOST }}
|
||||
SSH_USER: ${{ secrets.SSH_USER }}
|
||||
DOCKER_IMAGE: ${{ secrets.DOCKER_USERNAME }}/mirea-bakend:latest
|
||||
DOCKER_IMAGE: ${{ secrets.DOCKER_USERNAME }}/mirea-backend:latest
|
||||
run: |
|
||||
ssh-keyscan $SSH_HOST >> ~/.ssh/known_hosts
|
||||
ssh $SSH_USER@$SSH_HOST "
|
||||
docker pull $DOCKER_IMAGE &&
|
||||
docker stop mirea-bakend || true &&
|
||||
docker rm mirea-bakend || true &&
|
||||
docker run -d --name mirea-bakend -p 8085:8080 $DOCKER_IMAGE
|
||||
docker stop mirea-backend || true &&
|
||||
docker rm mirea-backend || true &&
|
||||
docker run -d --name mirea-backend -p 8085:8080 $DOCKER_IMAGE
|
||||
"
|
||||
|
||||
- name: Remove all keys from ssh-agent
|
@ -12,12 +12,12 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
- uses: actions/checkout@v4
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up .NET Core
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
dotnet-version: '8.0.x'
|
||||
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
|
@ -11,8 +11,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Elements of the solution",
|
||||
.env = .env
|
||||
.gitattributes = .gitattributes
|
||||
.gitignore = .gitignore
|
||||
.gitea\workflows\deploy-stage.yaml = .gitea\workflows\deploy-stage.yaml
|
||||
Dockerfile = Dockerfile
|
||||
.gitea\workflows\deploy.yaml = .gitea\workflows\deploy.yaml
|
||||
LICENSE.txt = LICENSE.txt
|
||||
README.md = README.md
|
||||
.gitea\workflows\test.yaml = .gitea\workflows\test.yaml
|
||||
|
Loading…
Reference in New Issue
Block a user