Skip to content

Commit

Permalink
push to acr
Browse files Browse the repository at this point in the history
  • Loading branch information
malisharfer committed May 9, 2024
1 parent 4ea4e6b commit 30e69f7
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 53 deletions.
104 changes: 52 additions & 52 deletions .github/workflows/acr-deployment.yml
Original file line number Diff line number Diff line change
@@ -1,64 +1,64 @@
# name: πŸš€ Build and deploy to acr
name: πŸš€ Build and deploy to acr

# on:
# push:
# branches: ["feature/acr-deployment"]
on:
push:
branches: ["feature/acr-deployment"]

# env:
# WORKING_DIR: users_management
env:
WORKING_DIR: users_management

# permissions:
# contents: read
# packages: write
# actions: read
permissions:
contents: read
packages: write
actions: read

# jobs:
# setup:
# runs-on: "ubuntu-latest"
# outputs:
# MATRIX: ${{ env.WORKING_DIR }}
jobs:
setup:
runs-on: "ubuntu-latest"
outputs:
MATRIX: ${{ env.WORKING_DIR }}

# steps:
# - name: πŸ“‚ Checkout repository
# uses: actions/checkout@v4
# with:
# fetch-depth: 0
# ref: ${{ github.event.inputs.branchName }}
steps:
- name: πŸ“‚ Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.inputs.branchName }}

# - name: πŸ› οΈ Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
- name: πŸ› οΈ Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# build-and-deploy:
# runs-on: "ubuntu-latest"
# needs: setup
# # strategy:
# # matrix:
# # directory: "users-management"
build-and-deploy:
runs-on: "ubuntu-latest"
needs: setup
# strategy:
# matrix:
# directory: "users-management"

# steps:
# - name: πŸ“‚ Checkout repository
# uses: actions/checkout@v4
# with:
# ref: ${{ github.event.inputs.branchName }}
steps:
- name: πŸ“‚ Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branchName }}

# - name: πŸ”‘ Login to Azure
# uses: azure/login@v1
# with:
# creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: πŸ”‘ Login to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

# - name: πŸ—οΈ Login to Container Registry
# uses: azure/docker-login@v1
# with:
# login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
# username: ${{ secrets.AZ_USERNAME }}
# password: ${{ secrets.AZ_PASSWORD }}
- name: πŸ—οΈ Login to Container Registry
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
username: ${{ secrets.AZ_USERNAME }}
password: ${{ secrets.AZ_PASSWORD }}

# - name: 🚚 Change Path Matrix Directory
# run: |
# CUSTOM_MATRIX_DIRECTORY=$(echo "${{ env.WORKING_DIR }}" | sed 's/\//./g')
# echo "CUSTOM_MATRIX_DIRECTORY=$CUSTOM_MATRIX_DIRECTORY" >> "$GITHUB_ENV"
- name: 🚚 Change Path Matrix Directory
run: |
CUSTOM_MATRIX_DIRECTORY=$(echo "${{ env.WORKING_DIR }}" | sed 's/\//./g')
echo "CUSTOM_MATRIX_DIRECTORY=$CUSTOM_MATRIX_DIRECTORY" >> "$GITHUB_ENV"
# - name: πŸ—οΈ Build and push Docker image to Azure Container Registry
# run: |
# ls
# az acr build -t ${{ secrets.REGISTRY_LOGIN_SERVER }}/${{ env.WORKING_DIR }}:0.0.1 -r ${{ secrets.REGISTRY_LOGIN_SERVER }} --file ./${{ env.WORKING_DIR }}/Dockerfile ./${{ env.WORKING_DIR }}
- name: πŸ—οΈ Build and push Docker image to Azure Container Registry
run: |
ls
az acr build -t ${{ secrets.REGISTRY_LOGIN_SERVER }}/${{ env.WORKING_DIR }}:0.0.1 -r ${{ secrets.REGISTRY_LOGIN_SERVER }} --file ./${{ env.WORKING_DIR }}/Dockerfile ./${{ env.WORKING_DIR }}
19 changes: 18 additions & 1 deletion .github/workflows/yuyu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,24 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
file: ./${{ env.WORKING_DIR }}/Dockerfile


- name: πŸ”‘ Login to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: πŸ—οΈ Login to Container Registry
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
username: ${{ secrets.AZ_USERNAME }}
password: ${{ secrets.AZ_PASSWORD }}

- name: 🐳 Docker Build & Push to ACR
run: |
docker build -t ${{ secrets.REGISTRY_LOGIN_SERVER }}.azurecr.io/${{ env.WORKING_DIR }}:${{ github.sha }} ./${{ env.WORKING_DIR }}
docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}.azurecr.io/${{ env.WORKING_DIR }}:${{ github.sha }}
# deploy:
# name: deployment
# needs: build
Expand Down

0 comments on commit 30e69f7

Please sign in to comment.