Update .github/workflows/build.yml
This commit is contained in:
parent
14beeea518
commit
2edc63c692
32
.github/workflows/build.yml
vendored
32
.github/workflows/build.yml
vendored
@ -1,14 +1,26 @@
|
|||||||
name: Build
|
name: Build and Push Docker Image
|
||||||
on: [push, pull_request]
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE_NAME: ${{ github.repository_owner }}/${{ github.event.repository.name }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- name: Checkout repository
|
||||||
- name: Set up Docker Buildx
|
uses: actions/checkout@v2
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
- name: Build
|
- name: Log in to the Docker registry
|
||||||
uses: docker/build-push-action@v3
|
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login ${{ secrets.DOCKER_REGISTRY }} -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
|
||||||
with:
|
|
||||||
push: false
|
- 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
|
Loading…
Reference in New Issue
Block a user