CI/CD Pipeline Using GitHub Actions for Dockerized Application | Lab task 3

visibility 0 visualizações schedule há 6 meses timer 9:15
open_in_new Dailymotion
hub.docker.com <br /><br /><br /><br />cicd-pipeline-demo <br /><br /><br /><br /><br />Hello! This app was deployed via GitHub Actions. <br /><br /><br />Dockerfile <br /><br /><br />FROM nginx:alpine <br />COPY index.html /usr/share/nginx/html <br /><br /><br /><br /><br />.github/workflows/docker.yml <br /><br /><br /><br /><br /><br />name: Build and Push Docker Image <br /><br />on: <br /> push: <br /> branches: [ "main" ] <br /><br />jobs: <br /> build-and-push: <br /> runs-on: ubuntu-latest <br /> <br /> steps: <br /> # 1. Check out the code from the repo <br /> - name: Checkout code <br /> uses: actions/checkout@v3 <br /><br /> # 2. Login to Docker Hub using the secrets you created <br /> - name: Login to Docker Hub <br /> uses: docker/login-action@v2 <br /> with: <br /> username: ${{ secrets.DOCKER_USERNAME }} <br /> password: ${{ secrets.DOCKER_PASSWORD }} <br /><br /> # 3. Build the image and Push it to Docker Hub <br /> - name: Build and push <br /> uses: docker/build-push-action@v4 <br /> with: <br /> context: . <br /> push: true <br /> # REPLACE 'your-docker-username' below with your actual username! <br /> tags: ${{ secrets.DOCKER_USERNAME }}/cicd-pipeline-demo:latest <br /><br />