My GitHub action
name: Deploy
on:
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
environment: default
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
- id: auth
name: "Auth"
uses: 'google-github-actions/auth@v2'
with:
token_format: access_token
workload_identity_provider: ${{ secrets.WIF_PROVIDER }}
service_account: ${{ secrets.SA_EMAIL }}
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
with:
version: '>= 363.0.0'
- name: 'Use gcloud CLI'
run: 'gcloud info'
#- name: 'Last ned BASED model fra cloud bucket'
#run: 'gcloud storage cp -r gs://mlops/model_llama_2 .'
- name: Print file list 1
run: |
find . -type f -print | sort
# find . -type d -print | sort
- name: 'Last ned LORA fra cloud bucket'
run: |
mkdir fine_tuned_model
gcloud storage cp -r gs://mlops/fine_tuned_lora fine_tuned_model/
- name: Print file list 2
run: |
find . -type f -print | sort
# find . -type d -print | sort
- uses: docker/login-action@v3
name: Login to Google Artifact Registry
with:
registry: europe-docker.pkg.dev
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}
- run: echo "TAG=$(git log -1 --pretty=%ad --date=format:%Y-%m-%d)-$(git log --pretty=format:'%h' -n 1)" >> $GITHUB_ENV
- uses: docker/build-push-action@v5
with:
file: Dockerfile
push: true
tags: europe-docker.pkg.dev/team2137/trygg/app:${{ env.TAG }}
# - name: "deploy app til cloud run"
# run: "gcloud run deploy <service-name> --image=<image-uri> --region=europe --allow-unauthenticated"
My docker file
FROM python:3.11
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["python", "app.py"]
My problem is the downloaded folder called fine_tuned_model is not being copied inside the docker container when docker finishes building. It copies everything else from GitHub but the downloaded folder from bucket. I have tried to even manually copy the dir in dockerfile with no luck!
As you can see I am also listing the dir files before and after step to see if it is being downloaded. And fine_tuned_model is being downloaded.
There are 2 types of context with build-push-action
:
you are using git context, so any file mutation in the steps that precede the build step will be ignored. However, you can use the Path context using the context input alongside the actions/checkout action to remove this restriction.