Bash apk Command not found

Hi I have the following Issue, I have tried to setup runners of both types(Shell and SSh) still could not pass the “Deploy stage” not sure why apk not found, Any suggestions would appreciated.

stages:

  • build
  • test
  • deploy

build website:
stage: build
script:
- touch Hasan.txt
artifacts:
paths:
- ./public1

test the artifacts:
image: alpine
stage: test
script:

  • grep -irl “rajpoot” ./public1/index.html

deploy the website:
stage: deploy
image: alpine
before_script:
- apk add openssh-client
- eval $(ssh-agent -s)
- echo “$SSH_PRIVATE_KEY” | tr -d ‘\r’ | ssh-add -
- mkdir -p ~/.ssh
- chmod 777 ~/.ssh
script:

- scp -r -o StrictHostKeyChecking=no ./public1 root@IP-Address:/home/hraza/Desktop/

Could be an environment problem in unable to find the path. Usually best to put the full path to apk, for example:

/usr/sbin/apk add openssh-client

you can check what the path should be by doing:

which apk

in your console, and then change appropriately under “before_script” in the above that you posted.