
* Simple docker build and push * Removed requirement of defining in the config.toml file, everything should be available from the environment * Added workflow dispatch
66 lines
1.7 KiB
YAML
66 lines
1.7 KiB
YAML
name: Build and Push Docker images
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Log in to Docker Hub
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/login-action@v2
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Build frontend Docker image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: app.dockerfile
|
|
push: false
|
|
tags: ${{ secrets.DOCKER_USERNAME }}/perplexica-frontend:latest
|
|
|
|
- name: Build backend Docker image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: backend.dockerfile
|
|
push: false
|
|
tags: ${{ secrets.DOCKER_USERNAME }}/perplexica-backend:latest
|
|
|
|
- name: Push frontend Docker image
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: app.dockerfile
|
|
push: true
|
|
tags: ${{ secrets.DOCKER_USERNAME }}/perplexica-frontend:latest
|
|
|
|
- name: Push backend Docker image
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: backend.dockerfile
|
|
push: true
|
|
tags: ${{ secrets.DOCKER_USERNAME }}/perplexica-backend:latest
|
|
|
|
- name: Log out from Docker Hub
|
|
if: github.event_name != 'pull_request'
|
|
run: docker logout
|