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