add pracirce #3
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: Module 1 | |
on: | |
push: | |
branches: | |
- main | |
env: | |
IMAGE_ML_APP: app-ml | |
IMAGE_ML_WEB: app-web | |
jobs: | |
ci-test-bash-code: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Test echo | |
run: | | |
echo 'test' | |
- name: Test ls | |
run: | | |
ls -all . | |
app-ml-docker: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | |
with: | |
images: ghcr.io/app-ml | |
- name: Build and push Docker image | |
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | |
with: | |
context: module-1/app-ml/ | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
# build-and-push-app-ml: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@v2 | |
# - name: Login to Docker Hub | |
# uses: docker/login-action@v1 | |
# with: | |
# username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
# password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
# - name: Set up Docker Buildx | |
# uses: docker/setup-buildx-action@v1 | |
# - name: Build and push | |
# uses: docker/build-push-action@v2 | |
# with: | |
# context: week-1/app-ml/ | |
# file: week-1/app-ml/Dockerfile | |
# push: true | |
# tags: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ env.IMAGE_ML_APP }}:latest | |
# cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/${{ env.IMAGE_ML_APP }}:buildcache | |
# cache-to: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/${{ env.IMAGE_ML_APP }}:buildcache,mode=max | |
# build-and-push-app-web: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@v2 | |
# - name: Login to Docker Hub | |
# uses: docker/login-action@v1 | |
# with: | |
# username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
# password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
# - name: Set up Docker Buildx | |
# uses: docker/setup-buildx-action@v1 | |
# - name: Build and push | |
# uses: docker/build-push-action@v2 | |
# with: | |
# context: week-1/app-web/ | |
# file: week-1/app-web/Dockerfile | |
# push: true | |
# tags: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ env.IMAGE_ML_WEB }}:latest | |
# cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/${{ env.IMAGE_ML_WEB }}:buildcache | |
# cache-to: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/${{ env.IMAGE_ML_WEB }}:buildcache,mode=max | |
# build-and-push-app-ml-cli-comands: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@v2 | |
# - name: Set up Docker Buildx | |
# uses: docker/setup-buildx-action@v1 | |
# - name: Login | |
# run: | | |
# docker login -u kyrylprojector -p ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
# - name: Build | |
# run: | | |
# docker build --tag kyrylprojector/app-ml:latest ./week-1/app-ml | |
# - name: Push | |
# run: | | |
# docker push kyrylprojector/app-ml:latest | |
# - name: Run ok | |
# run: | | |
# docker run --rm --name app-ml-test-run kyrylprojector/app-ml:latest | |
# k8s-test-deployment-action: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Create k8s Kind Cluster | |
# uses: helm/[email protected] | |
# - name: Checkout | |
# uses: actions/checkout@v2 | |
# - name: Deploy application | |
# run: | | |
# kubectl create -f week-1/k8s-resources/deployment-app-web.yaml | |
# - name: Print pods | |
# run: | | |
# sleep 5 && kubectl get pod -A | |
# - name: Print pods | |
# run: | | |
# kubectl wait --for=condition=available --timeout=90s deployment/deployments-app-web | |
# - name: Print pods | |
# run: | | |
# sleep 5 && kubectl get pod -A | |
# k8s-test-job-cli: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Check out code | |
# uses: actions/checkout@v2 | |
# - name: Set up Go | |
# uses: actions/setup-go@v2 | |
# with: | |
# go-version: 1.17 | |
# - name: Install and configure KinD | |
# run: | | |
# GO111MODULE="on" go get sigs.k8s.io/[email protected] | |
# sudo mv $(go env GOPATH)/bin/kind /usr/local/bin/ | |
# kind create cluster | |
# - name: Set up kubectl | |
# run: | | |
# kubectl cluster-info | |
# kubectl config use-context kind-kind | |
# - name: Deploy application | |
# run: | | |
# kubectl create -f week-1/k8s-resources/job-app-ml.yaml | |
# - name: Print pods | |
# run: | | |
# sleep 5 && kubectl get pod -A | |
# - name: Run tests | |
# run: | | |
# kubectl wait --for=condition=complete --timeout=90s job/job-app-ml | |
# - name: Print pods | |
# run: | | |
# sleep 5 && kubectl get pod -A | |
# - name: Clean up | |
# run: | | |
# kind delete cluster |