2025-02-13 10:34:58 +00:00
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: default
|
|
|
|
|
|
|
|
steps:
|
2025-02-13 10:48:23 +00:00
|
|
|
- name: build and test
|
|
|
|
image: python:3.9-slim
|
|
|
|
commands:
|
|
|
|
- pip install --no-cache-dir -r requirements.txt
|
2025-02-13 13:47:52 +00:00
|
|
|
- python app.py & # Run the Flask app in the background to simulate deployment
|
|
|
|
|
|
|
|
- name: build docker image and deploy
|
|
|
|
image: docker:20.10 # Docker image to build and run the container
|
|
|
|
services:
|
|
|
|
- name: docker
|
|
|
|
image: docker:20.10
|
|
|
|
privileged: true # Allow Docker-in-Docker for building the image
|
|
|
|
commands:
|
|
|
|
- docker build -t my-flask-app:${DRONE_BUILD_NUMBER} . # Build Docker image
|
|
|
|
- docker run -d -p 5000:5000 my-flask-app:${DRONE_BUILD_NUMBER} # Run Flask app in container
|
2025-02-13 10:48:23 +00:00
|
|
|
|
|
|
|
trigger:
|
|
|
|
branch:
|
2025-02-13 13:47:52 +00:00
|
|
|
- master
|