From a6693ffe8f84b5001f2bf80eae7fec26d5622834 Mon Sep 17 00:00:00 2001 From: jakeus46 Date: Tue, 26 Nov 2024 22:58:11 +0500 Subject: [PATCH] Create docker-pipeline.yml --- docker-pipeline.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 docker-pipeline.yml diff --git a/docker-pipeline.yml b/docker-pipeline.yml new file mode 100644 index 0000000..4f1e7a1 --- /dev/null +++ b/docker-pipeline.yml @@ -0,0 +1,36 @@ +name: Docker Pipeline + +on: + push: + branches: + - main # Запуск на каждом push в ветку main + pull_request: + branches: + - main + +jobs: + pipeline: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Log in to DockerHub + env: + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + run: echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin + + - name: Build Docker Image + run: | + if [ -f Dockerfile ]; then + docker build -t whalesay-image . + else + echo "Dockerfile not found!" + exit 1 + fi + + - name: Run Docker Container + run: | + docker run --rm whalesay-image cowsay "Hello from GitHub Actions!"