I have created jobs for build and deploy.
The jobs are running perfectly without no errors and the project is deployed successfully.
The problem is though the repository is changed the build is not showing up the changes when tested in the browser although the workspace is successfully pulling the latest code with changes.
Few tried solutions
Made the docker image build not use the cache
Made the workspace clear before starting the build
Nothing seems working. Where might have things gone wrong?
My project structure:
Project directory: Which will have all the laravel project
Dockerfile: to build the image
docker-compose.yml: To deploy the service in docker stack
I am running the service in docker stack using docker stack deploy
command
I tried to delete the previously build docker stack .By naming the docker stack unique with buildID and re-create a new stack but it didn't solve either.
On trying to remove the stack and generate that again. I get these issues.
Failed to remove network 7bkf0kka11s08k3vnpfac94q8: Error response from daemon: rpc error: code = FailedPrecondition desc = network 7bkf0kka11s08k3vnpfac94q8 is in use by task lz2798yiviziufc5otzjv5y0gFailed to remove some resources from stack: smstake43
- Why is the docker stack not taking the updated image looks like it's due to the digest issue. How can it be solved if it is? Though the changes are pushed to Btbucket code repo the deployment is not showing changes due to it. If I completely do all the setup then only it fetches the latest codes.
This is bash scripts for build in jenkins jobs
#!/bin/sh
docker build -t smstake:latest .
docker stack deploy -c docker-compose.yml smstake
build
anddeploy
jobs you have configured. Suggestion from my end is you are may be forgetting to build your code using docker build. – Thirstydocker build -t <dir path> .
like this in your build step after pulling the latest code. You may be deploying the same image again and again. – Thirstydocker stack rm <stac-name>
This is working but the build fails and than pass consecutively. This is the error I am getting on fail jobs.Removing service smstake_app Removing service smstake_db Removing service smstake_phpmyadmin Removing network smstake_smstake Creating service smstake_db failed to create service smstake_db: Error response from daemon: network smstake_smstake not found Build step 'Execute shell' marked build as failure Finished: FAILURE
– Pantelegraphsed
to pass the value to the image field in the docker-compose.yml. by using some keys there based on which replace will occur. It was not accepting the variable so did so. – Pantelegraph