Docker build & push (#2)

* Simple docker build and push
* Removed requirement of defining in the config.toml file, everything should be available from the environment
* Added workflow dispatch
This commit is contained in:
Andrew Pennington 2024-08-15 19:12:31 +01:00 committed by GitHub
parent 2da65182cb
commit 7d5eec898d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 68 additions and 19 deletions

View file

@ -1,4 +1,4 @@
name: Hello World Workflow
name: Build and Push Docker images
on:
workflow_dispatch:
@ -10,8 +10,57 @@ on:
- master
jobs:
say-hello:
build:
runs-on: ubuntu-latest
steps:
- name: Say Hello World
run: echo "Hello, World!"
- 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