Last active
October 17, 2023 06:09
-
-
Save WasathTheekshana/825aaeed6538d37c948f848602057f8e to your computer and use it in GitHub Desktop.
Deploy a Docker Container to Azure Container Registry with a GitHub action
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: [push] | |
name: Linux_Container_Workflow | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# checkout the repo | |
- name: 'Checkout GitHub Action' | |
uses: actions/checkout@main | |
- name: 'Login via Azure CLI' | |
uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: 'Build and push image' | |
uses: azure/docker-login@v1 | |
with: | |
login-server: ${{ secrets.REGISTRY_SERVER }} | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
- run: | | |
docker build . -t ${{ secrets.REGISTRY_SERVER }}/yourcontainername:latest | |
docker push ${{ secrets.REGISTRY_SERVER }}/yourcontainername:latest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
First add the repo secrets to the
GitHub Secrets