- API with Go
- Docker
- Build image with multi-stage build
- Best practices for writing Dockerfiles
- Docker compose
- CI/CD with Jenkins
- Static Code Analysis
sonar-scanner.properties
sonar.host.url=http://128.199.199.84:9000
sonar.login=xxx
sonar.password=xxx
$git clone https://github.com/up1/workshop-devops-go.git
cd workshop-devops-go
Working with Docker command
$cd api
$docker image build -t somkiat/demo-api .
$docker container run -d --name api -p 8000:1323 somkiat/demo-api
$docker container ps
Working with Docker compose
$docker-compose build
$docker-compose up -d
$docker-compose ps
$docker-compose logs --follow
Deploy with shell script
$sh deploy.sh
$docker-compose ps
$docker-compose logs --follow
URL for testing
- working with free style job
- working with Jenkinsfile (Pipeline as a Code)
Design youe pipeline
- Pull code
- Build
- Testing
- Build Docker image
- Push Docker image to Registry server
- Deploy to target server
- Docker
- Kubernetes cluster
List of Jenkins's plugins
Create Docker Swarm
$docker swarm init
$docker node ls
See join-token command
$docker swarm join-token worker
$docker swarm join-token manager
Deploy stack with docker-compose file (v3+)
$docker stack deploy --compose-file docker-compose-deploy.yml demostack
$docker stack services demostack
Scaling service
docker service ls
$docker service scale <service name>=<number of replica(s)>
$docker service ls
$docker service ps <service name>
Example scale to 5
$docker service scale demostack_api=5
demostack_api scaled to 5 overall progress: 5 out of 5 tasks 1/5: running [==================================================>] 2/5: running [==================================================>] 3/5: running [==================================================>] 4/5: running [==================================================>] 5/5: running [==================================================>] verify: Service converged
Testing with curl and see result
$curl http://localhost:8000/
Delete services
$docker service rm <service name>
Delete stack
$docker stack rm demostack
Leave node from Swarm
$docker swarm leave --force
$kubectl get node
$kubectl apply -f k8s/
$kubectl get all