-
Notifications
You must be signed in to change notification settings - Fork 0
34 lines (27 loc) · 987 Bytes
/
docker-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
name: Build and Push Docker Image
on:
push:
branches:
- main # Adjust this if your main branch has a different name
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checkout the repository code
- name: Checkout repository
uses: actions/checkout@v3
# Set up Docker
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Build the Docker image with a lowercase tag
- name: Build Docker image
run: docker build -t studywizapp .
# Tag the Docker image for Docker Hub with a lowercase name
- name: Tag Docker image
run: docker tag studywizapp:latest ${{ secrets.DOCKER_USERNAME }}/studywizapp:latest
# Push the Docker image to Docker Hub
- name: Push Docker image to Docker Hub
run: docker push ${{ secrets.DOCKER_USERNAME }}/studywizapp:latest