Skip to content

Commit

Permalink
Added portal deploy pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
GrPe committed Jul 18, 2024
1 parent 9427a49 commit 2982fe6
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/deploy_api.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build
name: Deploy API
on:
workflow_dispatch:
push:
Expand Down
80 changes: 80 additions & 0 deletions .github/workflows/deploy_portal
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Deploy Portal
on:
workflow_dispatch:
push:
branches:
- master
paths:
- src/Overmoney.Portal/**

env:
PROJECT_NAME: src/Overmoney.Portal/
DOCKER_FILE: src/Overmoney.Portal/Dockerfile

jobs:
build_and_test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.PROJECT_NAME }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "20.x"

- name: Install dependencies
run: npm install

- name: Build project
run: npm run build --production

build_portal_docker_image:
runs-on: ubuntu-latest
needs: build_and_test
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and export Docker Image
uses: docker/build-push-action@v6
with:
context: ${{ env.PROJECT_NAME }}
file: ${{ env.DOCKER_FILE }}
tags: overmoney_portal
outputs: type=docker,dest=/tmp/overmoney_portal.tar

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: overmoney_portal
path: /tmp/overmoney_portal.tar

push_portal_image:
runs-on: self-hosted
needs: build_portal_docker_image
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: overmoney_portal
path: /tmp

- name: Load image
run: |
docker load --input /tmp/overmoney_portal.tar

- name: Add image tag
run: docker tag overmoney_portal:latest localhost:5000/overmoney_portal

- name: Push image
run: docker push localhost:5000/overmoney_portal

- name: Restart container
run: docker run -rm --name overmoney_update -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --run-once overmoney_portal

0 comments on commit 2982fe6

Please sign in to comment.