Skip to content

Kód1 Action

Kód1 Action #3

Workflow file for this run

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:
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:
# Semantic version range syntax or exact version of a Python version
python-version: '3.11'
# Optional - x64 or x86 architecture, defaults to x64
architecture: 'x64'
# You can test your matrix by printing the current Python version
- name: Display Python version
run: python -c "import sys; print(sys.version)"
deploy:
runs-on: ubuntu-latest
steps:
- name: Kód letöltése
if: github.event_name != 'pull_request'
uses: actions/checkout@v4
- name: ACR bejelentkezés
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ secrets.ACR_LOGIN_SERVER }}
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
- name: Extract Docker metadata
if: github.event_name != 'pull_request'
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
if: github.event_name != 'pull_request'
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
if: github.event_name != 'pull_request'
run: docker logout ${{ secrets.ACR_LOGIN_SERVER }}