name: Docker Build and Test
on:
push:
branches:
- main # À ajuster selon votre branche principale
pull_request:
branches:
- main # À ajuster selon votre branche principale
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build Docker image
run: docker build -t myapp .
- name: Run container
run: docker run -d --name myapp -p 3000:3000 myapp
- name: Check if container is running
run: docker ps | grep myapp
- name: Test application
run: |
sleep 10 # Wait a bit for the application to start
curl --insecure https://0.0.0.0:3000 -vvv
- name: Stop and remove the container
run: docker stop myapp && docker rm myapp
Contenu du CI :