feat(docker): add prebuilt images

This commit is contained in:
ItzCrazyKns 2024-10-02 21:59:40 +05:30
parent 425a08432b
commit fc5e35b1b1
3 changed files with 48 additions and 1 deletions

46
.github/workflows/docker-build.yaml vendored Normal file
View File

@ -0,0 +1,46 @@
name: Build & Push Docker Image
on:
push:
branches:
- main
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
- 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
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: |
docker build -f backend.dockerfile -t itzcrazykns1337/perplexica-backend:main .
docker build -f app.dockerfile -t itzcrazykns1337/perplexica-frontend:main .
docker push itzcrazykns1337/perplexica-backend:main
docker push itzcrazykns1337/perplexica-frontend:main
- name: Build and push release Docker image
if: github.event_name == 'release'
run: |
docker build -f backend.dockerfile -t itzcrazykns1337/perplexica-backend:${{ env.RELEASE_VERSION }} .
docker build -f app.dockerfile -t itzcrazykns1337/perplexica-frontend:${{ env.RELEASE_VERSION }} .
docker push itzcrazykns1337/perplexica-backend:${{ env.RELEASE_VERSION }}
docker push itzcrazykns1337/perplexica-frontend:${{ env.RELEASE_VERSION }}

View File

@ -7,7 +7,6 @@ WORKDIR /home/perplexica
COPY src /home/perplexica/src COPY src /home/perplexica/src
COPY tsconfig.json /home/perplexica/ COPY tsconfig.json /home/perplexica/
COPY config.toml /home/perplexica/
COPY drizzle.config.ts /home/perplexica/ COPY drizzle.config.ts /home/perplexica/
COPY package.json /home/perplexica/ COPY package.json /home/perplexica/
COPY yarn.lock /home/perplexica/ COPY yarn.lock /home/perplexica/

View File

@ -15,6 +15,7 @@ services:
dockerfile: backend.dockerfile dockerfile: backend.dockerfile
args: args:
- SEARXNG_API_URL=http://searxng:8080 - SEARXNG_API_URL=http://searxng:8080
image: itzcrazykns1337/perplexica-backend:main
depends_on: depends_on:
- searxng - searxng
ports: ports:
@ -35,6 +36,7 @@ services:
args: args:
- NEXT_PUBLIC_API_URL=http://127.0.0.1:3001/api - NEXT_PUBLIC_API_URL=http://127.0.0.1:3001/api
- NEXT_PUBLIC_WS_URL=ws://127.0.0.1:3001 - NEXT_PUBLIC_WS_URL=ws://127.0.0.1:3001
image: itzcrazykns1337/perplexica-frontend:main
depends_on: depends_on:
- perplexica-backend - perplexica-backend
ports: ports: