docker path to docker-compose #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CICD | ||
on: | ||
push: | ||
branches: | ||
- cicd | ||
jobs: | ||
publish: | ||
runs-on: | ||
ubuntu-latest | ||
steps: | ||
## Step 1: Configuration | ||
- uses: actions/checkout@v3 | ||
- uses: s4u/[email protected] | ||
- name: Set up JDK | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
## Step 2: Docker Login and Image Build | ||
- name: Login to docker | ||
run: docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" -p "${{ secrets.DOCKERHUB_TOKEN }}" | ||
- name: Build the docker image | ||
run: docker build -t "${{ secrets.DOCKERHUB_USERNAME }}"/"${{ secrets.DOCKERHUB_IMAGE }}" -f docker/Dockerfile . | ||
## Step 3: Image Execution and Wait to Image Start | ||
## Step 3: Instalar Docker Compose | ||
- name: Install docker-compose | ||
run: | | ||
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | ||
sudo chmod +x /usr/local/bin/docker-compose | ||
docker-compose --version # Verifica que docker-compose se haya instalado correctamente | ||
-name: Change path | ||
run: cd docker | ||
- name: Setup docker compose | ||
run: docker-compose up -d | ||
- name: Give permissions to wait containers start script | ||
run: chmod +x waitContainers.sh | ||
- name: Wait for containers to start | ||
run: ./waitContainers.sh | ||
## Step 4: Test execution | ||
- name: Run tests | ||
run: mvn clean test -Dtest=LoginUiTests.java | ||
## Step 5: End Image Execution and Push image to Docker Hub | ||
- name: Stop docker compose | ||
run: docker-compose down | ||
- name: Push the docker image | ||
run: docker push ${{ secrets.DOCKERHUB_IMAGE }} | ||
- name: Push the docker image | ||
run: docker push ${{ secrets.DOCKERHUB_IMAGE }} |