Merge pull request #13 from Ulas-Scan/develop #21
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: Build and Push to Artifact Registry | |
env: | |
APP_NAME: ulascan-ml | |
GCE_INSTANCE_IP: ${{ secrets.GCE_INSTANCE_IP }} | |
GCE_INSTANCE_NAME: ${{ secrets.GCE_INSTANCE_NAME }} | |
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} | |
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }} | |
GCP_REGION: ${{ secrets.GCP_REGION }} | |
GCP_ZONE: ${{ secrets.GCP_ZONE }} | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests tqdm | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Authenticate to Google Cloud | |
uses: google-github-actions/auth@v1 | |
with: | |
credentials_json: ${{ secrets.GCP_SA_KEY }} | |
- name: Set up Google Cloud SDK | |
uses: google-github-actions/setup-gcloud@v1 | |
with: | |
project_id: ${{ secrets.GCP_PROJECT_ID }} | |
- name: Configure docker for Artifact Registry | |
run: | | |
gcloud --quiet auth configure-docker $GCP_REGION-docker.pkg.dev | |
- name: Run file download script | |
run: python download.py | |
- name: Build and push Docker image | |
run: | | |
docker build -t $GCP_REGION-docker.pkg.dev/$GCP_PROJECT_ID/ulascan/$APP_NAME:latest . | |
docker push $GCP_REGION-docker.pkg.dev/$GCP_PROJECT_ID/ulascan/$APP_NAME:latest |