Kód1 Action #7
Workflow file for this run
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
name: Kód2 (python-flask-app-01) - Épít és feltölt | |
# Kód4 példához - Épít és feltölt Docker image-t Azure Container Registry-be | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "Kod2/01/**" | |
pull_request: | |
paths: | |
- "Kod2/01/**" | |
env: | |
APP_NAME: python-flask-app-01 # Alkalmazás képfájl neve | |
jobs: | |
test: | |
name: Tesztelés (CI) | |
if: github.event_name == 'pull_request' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Kód letöltése | |
uses: actions/checkout@v4 | |
- name: Python beállítása | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
architecture: 'x64' | |
- name: Python verzió megjelenítése | |
run: python -c "import sys; print(sys.version)" | |
- name: Python csomagok telepítése | |
run: | | |
cd Kod2/01 | |
pip install -r requirements.txt | |
- name: Tesztelés | |
run: | | |
cd Kod2/01 | |
python -m unittest test_app.py | |
deploy: | |
name: Telepítés (CD) | |
if: github.event_name != 'pull_request' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Kód letöltése | |
uses: actions/checkout@v4 | |
- name: ACR bejelentkezés | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ secrets.ACR_LOGIN_SERVER }} | |
username: ${{ secrets.ACR_USERNAME }} | |
password: ${{ secrets.ACR_PASSWORD }} | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ secrets.ACR_LOGIN_SERVER }}/${{ env.APP_NAME }} | |
tags: | | |
type=sha | |
type=raw,value=latest | |
type=semver,pattern={{version}},event=tag | |
- name: Épít és feltölt | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./Kod2/01 | |
file: ./Kod2/01/Dockerfile | |
push: true | |
platforms: linux/amd64 | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: ACR kijelentkezés | |
run: docker logout ${{ secrets.ACR_LOGIN_SERVER }} |