Added automatic docker build on merge to master
This PR includes: - Automatic build & push to docker hub when pushing to master, or when triggering a workflow dispatch on master - Automatic docker build on pull requests to validate changes - Updated the docker-compose.yaml to use the container images, rather than building locally - Added support for defining backend settings using the container environment -> All options defined in config.toml can now be loaded instead from the environment -> Order of precedence is environment definition, config.toml, and finally default inline configuration defined in config.ts - Added support for defining frontend settings using the container environment -> Added a dynamic api route to load the container environment definitions on the server, and provide them to the client -> Added a library function to fetch from the newly created API, caching the response in the session storage -> Modified existing calls to `process.env` to use the new library function -> Left the initial statically compiled environment definitions in place as a backup definition, if no environment definitions are provided Remaining tasks todo before able to merge to [ItzCrazyKns/Perplexica](https://github.com/ItzCrazyKns/Perplexica): - Add secret definitions for `DOCKER_USERNAME` and `DOCKER_PASSWORD` to [ItzCrazyKns/Perplexica](https://github.com/ItzCrazyKns/Perplexica) to ensure push to dockerhub works on base branch - Update documentation with information about changes
This commit is contained in:
parent
9c1936ec2c
commit
ec158c0cdf
15 changed files with 176 additions and 43 deletions
48
.github/workflows/docker-build.yml
vendored
Normal file
48
.github/workflows/docker-build.yml
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
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: ${{ (github.event_name != 'pull_request') && (github.ref == 'refs/heads/master') }}
|
||||
tags: ${{ secrets.DOCKER_USERNAME }}/perplexica-frontend:latest
|
||||
|
||||
- name: Build backend Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: backend.dockerfile
|
||||
push: ${{ (github.event_name != 'pull_request') && (github.ref == 'refs/heads/master') }}
|
||||
tags: ${{ secrets.DOCKER_USERNAME }}/perplexica-backend:latest
|
||||
|
||||
- name: Log out from Docker Hub
|
||||
if: github.event_name != 'pull_request'
|
||||
run: docker logout
|
Loading…
Add table
Add a link
Reference in a new issue