Skip to content

Commit

Permalink
Merge pull request #142 from langchain-ai/infra/update-dockerfile
Browse files Browse the repository at this point in the history
Setup ci/cd for opengpts, fix docker-compose
  • Loading branch information
langchain-infra authored Jan 28, 2024
2 parents 005bb8e + 6300414 commit 4cc214d
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/build_deploy_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build, Push, and Deploy Open GPTS

on:
push:
branches: [main]
workflow_dispatch:

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Short Hash
run: |
echo "GIT_SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Set up depot.dev multi-arch runner
uses: depot/setup-action@v1

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.LANGCHAIN_DOCKERHUB_USERNAME }}
password: ${{ secrets.LANGCHAIN_DOCKERHUB_PASSWORD }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
platforms: linux/amd64,linux/arm64
tags: "docker.io/langchain/open-gpts:${{ env.GIT_SHORT_SHA }}, docker.io/langchain/open-gpts:latest"
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM node:18 AS builder

WORKDIR /frontend

COPY ./frontend/package.json ./frontend/yarn.lock ./

RUN yarn --network-timeout 600000 --frozen-lockfile

COPY ./frontend ./

RUN rm -rf .env

RUN yarn build

# Backend Dockerfile
FROM python:3.11

# Install system dependencies
RUN apt-get update && apt-get install -y libmagic1 && rm -rf /var/lib/apt/lists/*

# Set the working directory
WORKDIR /backend

COPY ./backend .

RUN rm poetry.lock

RUN pip install .

# Copy the frontend build
COPY --from=builder /frontend/dist /ui

ENTRYPOINT [ "uvicorn", "app.server:app", "--host", "0.0.0.0" ]
21 changes: 21 additions & 0 deletions docker-compose-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: "3"

services:
redis:
container_name: opengpts-redis
image: redis/redis-stack-server:latest
ports:
- "6379:6379"
volumes:
- ./redis-volume:/data
backend:
container_name: opengpts-backend
image: docker.io/langchain/open-gpts:latest
ports:
- "8100:8000" # Backend is accessible on localhost:8100 and serves the frontend
depends_on:
- redis
env_file:
- .env
environment:
REDIS_URL: "redis://opengpts-redis:6379"

0 comments on commit 4cc214d

Please sign in to comment.