Skip to content

Commit

Permalink
update .github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
liyh42 committed Aug 13, 2024
1 parent e32179f commit 3e68756
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
22 changes: 14 additions & 8 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
name: Docker Image CI
name: Build and Push Docker Image to Docker Hub

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Build the Docker image
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)

- name: login to docker registry
uses: docker/login-action@v3
with:
username: ${{secrets.DOCKERHUB_USERNAME}}
password: ${{secrets.DOCKERHUB_TOKEN}}

- name: build and push docker image to registry
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: alvinleee/github-action-test:latest
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.swp

0 comments on commit 3e68756

Please sign in to comment.