Skip to content

Commit

Permalink
feat: added the cd/cd pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnatG committed Jul 18, 2023
1 parent a196bc2 commit ec1f5dd
Show file tree
Hide file tree
Showing 6 changed files with 288 additions and 272 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.env
.github
.gitattributes
.gitignore
.npmrc
dist
node_modules
66 changes: 66 additions & 0 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Build and deploy

on:
push:
branches:
- main
workflow_dispatch:

env:
ENVIRONMENT: infrastructure
TIMEZONE: "Europe/London"
REGISTRY_NAME: ${{ vars.REGISTRY_NAME }}
APP_NAME: "app-prototypekit-credit-risk-dev-001"

jobs:
# 1. Setup deployment variables
setup:
name: Setup 🔧
runs-on: ubuntu-latest
outputs:
environment: ${{ env.ENVIRONMENT }}
timezone: ${{ env.TIMEZONE }}
steps:
- name: Environment 🧪
run: echo "Environment set to ${{ env.ENVIRONMENT }}"

- name: Timezone 🌐
run: echo "Timezone set to ${{ env.TIMEZONE }}"

build:
name: Build & Push
needs: setup
environment: ${{ needs.setup.outputs.environment }}
env:
ENVIRONMENT: ${{ needs.setup.outputs.environment }}
runs-on: ubuntu-latest
steps:
- name: Repository 🗃️
uses: actions/checkout@v3

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

- name: Log in to container registry
uses: docker/login-action@v2
with:
registry: https://${{ env.REGISTRY_NAME }}.azurecr.io
username: ${{ secrets.CAPROTOTYPEKITDEV001_REGISTRY_USERNAME }}
password: ${{ secrets.CAPROTOTYPEKITDEV001_REGISTRY_PASSWORD }}

- name: Build & Push to ACR 📦️
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ env.REGISTRY_NAME }}.azurecr.io/prototypekit-credit-risk:latest
file: ./Dockerfile

- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.APP_NAME }}
slot-name: "production"
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
images: "${{ env.REGISTRY_NAME }}.azurecr.io/prototypekit-credit-risk:latest"
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Node.js ignores
node_modules/

# Prototype ignores - per-user
.tmp/
.env
migrate.log
usage-data-config.json

# General ignores
.DS_Store
.idea
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
version: "3"
services:
prototype-kit:
prototypekit-credit-risk:
build:
context: .
image: prototype-kit-cr
image: prototypekit-credit-risk
restart: always
ports:
- "3000:3000"
Expand Down
Loading

0 comments on commit ec1f5dd

Please sign in to comment.