-
Notifications
You must be signed in to change notification settings - Fork 859
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #142 from langchain-ai/infra/update-dockerfile
Setup ci/cd for opengpts, fix docker-compose
- Loading branch information
Showing
3 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |