hello_python_ci.yml #1
This file contains hidden or 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: Hello Python App to Docker | |
| on: | |
| push: | |
| workflow_dispatch: | |
| jobs: | |
| build-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.13' | |
| - name: Install Dependencies | |
| working-directory: docker/app1-hello/python | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Run Smoke Test | |
| working-directory: docker/app1-hello/python | |
| run: python -m py_compile main.py | |
| docker-build-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Build and Push Image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: docker/app1-hello/python | |
| push: true | |
| tags: | | |
| ${{ secrets.DOCKER_USERNAME }}/hello-python:latest | |