forked from CaseManagementAI/CommonAssessmentTool
-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (32 loc) · 831 Bytes
/
Copy pathcd.yml
File metadata and controls
39 lines (32 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: CD Pipeline
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
cd:
runs-on: ubuntu-latest
steps:
# Checkout the code
- name: Checkout Code
uses: actions/checkout@v3
# Build Docker Image
- name: Build Docker Image
run: docker build -t my-api .
# Run the Docker Container
- name: Run Docker Container
run: docker run -d --name my-container -p 8080:80 my-api
# Test the Running Container
- name: Test API Endpoints
run: |
sleep 10 # Allow some time for the container to start
curl --fail http://0.0.0.0:8080/docs || exit 1
echo "API is accessible and working!"
# Stop and Remove the Container
- name: Cleanup
run: |
docker stop my-container
docker rm my-container