update render build

This commit is contained in:
timothycarambat 2024-02-21 15:09:53 -08:00
parent addb3d0c3e
commit 210692472a
2 changed files with 33 additions and 14 deletions

View File

@ -1,4 +1,4 @@
name: Publish Docker image for Render.com deployments name: Publish Docker image for Render & Railway deployments
concurrency: concurrency:
group: build-${{ github.ref }} group: build-${{ github.ref }}
@ -18,7 +18,7 @@ on:
jobs: jobs:
push_to_registries: push_to_registries:
name: Push Docker image to DockerHub for use on Render.com deployments name: Push Docker image to DockerHub for use on Render or Railway deployments
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
packages: write packages: write
@ -27,8 +27,26 @@ jobs:
- name: Check out the repo - name: Check out the repo
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Check if DockerHub build needed
shell: bash
run: |
# Check if the secret for USERNAME is set (don't even check for the password)
if [[ -z "${{ secrets.DOCKER_USERNAME }}" ]]; then
echo "DockerHub build not needed"
echo "enabled=false" >> $GITHUB_OUTPUT
else
echo "DockerHub build needed"
echo "enabled=true" >> $GITHUB_OUTPUT
fi
id: dockerhub
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub - name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
# Only login to the Docker Hub if the repo is mintplex/anythingllm, to allow for forks to build on GHCR
if: steps.dockerhub.outputs.enabled == 'true'
with: with:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
@ -38,16 +56,22 @@ jobs:
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with: with:
images: | images: |
mintplexlabs/anythingllm ${{ steps.dockerhub.outputs.enabled == 'true' && 'mintplexlabs/anythingllm' || '' }}
ghcr.io/${{ github.repository }}
tags: |
type=raw,value=render
type=raw,value=railway
- name: Build and push Docker images - name: Build and push multi-platform Docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 uses: docker/build-push-action@v5
with: with:
context: . context: .
file: ./docker/render.Dockerfile file: ./docker/render.Dockerfile
platforms: linux/amd64
push: true push: true
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: | build-args: |
"STORAGE_DIR=/storage" "STORAGE_DIR=/storage"

View File

@ -59,11 +59,6 @@ FROM base as server-deps
COPY ./server/package.json ./server/yarn.lock ./server/ COPY ./server/package.json ./server/yarn.lock ./server/
RUN cd ./server/ && yarn install --production --network-timeout 100000 && yarn cache clean RUN cd ./server/ && yarn install --production --network-timeout 100000 && yarn cache clean
# Compile Llama.cpp bindings for node-llama-cpp for this operating system.
USER root
RUN cd ./server && npx --no node-llama-cpp download
USER anythingllm
# Build the frontend # Build the frontend
FROM frontend-deps as build-stage FROM frontend-deps as build-stage
COPY ./frontend/ ./frontend/ COPY ./frontend/ ./frontend/