perplexica/.github/workflows/docker-build.yaml

46 lines
1.6 KiB
YAML
Raw Normal View History

2024-10-02 16:29:40 +00:00
name: Build & Push Docker Image
on:
push:
branches:
2024-10-02 16:30:46 +00:00
- master
2024-10-02 16:29:40 +00:00
release:
types: [published]
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
install: true
2024-10-02 16:29:40 +00:00
- name: Log in to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract version from release tag
if: github.event_name == 'release'
id: version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Build and push Docker image
2024-10-02 16:31:49 +00:00
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
2024-10-02 16:29:40 +00:00
run: |
docker buildx create --use
docker buildx build --platform linux/amd64,linux/arm64 -f backend.dockerfile -t itzcrazykns1337/perplexica-backend:main --push .
docker buildx build --platform linux/amd64,linux/arm64 -f app.dockerfile -t itzcrazykns1337/perplexica-frontend:main --push .
2024-10-02 16:29:40 +00:00
- name: Build and push release Docker image
if: github.event_name == 'release'
run: |
docker buildx create --use
docker buildx build --platform linux/amd64,linux/arm64 -f backend.dockerfile -t itzcrazykns1337/perplexica-backend:${{ env.RELEASE_VERSION }} --push .
docker buildx build --platform linux/amd64,linux/arm64 -f app.dockerfile -t itzcrazykns1337/perplexica-frontend:${{ env.RELEASE_VERSION }} --push .