eric Liu
836332cb75
All checks were successful
Build and Push Docker Image / build (push) Successful in 47s
30 lines
872 B
YAML
30 lines
872 B
YAML
name: Build and Push Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
IMAGE_NAME: ${{ github.repository_owner }}/${{ github.event.repository.name }}
|
|
DOCKER_HOST: tcp://docker.local:2375
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: ${{ github.repository }}
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Log in to the Docker registry
|
|
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login ${{ secrets.DOCKER_REGISTRY }} -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
|
|
|
|
- name: Build the Docker image
|
|
run: docker build -t ${{ secrets.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest .
|
|
|
|
- name: Push the Docker image
|
|
run: docker push ${{ secrets.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest |