From 1f8520cdadf6b3d47c1c2b3f43e316f16ada86c9 Mon Sep 17 00:00:00 2001 From: Danny Avila <110412045+danny-avila@users.noreply.github.com> Date: Thu, 27 Jul 2023 18:52:10 -0400 Subject: [PATCH] wip: testing leaner docker strategy and deployment compose file (#719) * nginx setup * chore(dev-images.yml): update workflow trigger to push events on main branch chore(dev-images.yml): remove building and pushing of librechat-dev-client image chore(nginx.conf): comment out SSL configuration in nginx.conf chore(deploy-compose.yml): uncomment api build configuration in deploy-compose.yml chore(deploy-compose.yml): update client build configuration in deploy-compose.yml --- .github/workflows/dev-images.yml | 10 +++------- Dockerfile.multi | 1 - client/nginx.conf | 8 ++++++-- deploy-compose.yml | 10 +++++++++- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/.github/workflows/dev-images.yml b/.github/workflows/dev-images.yml index 1ddd7b98c5..09fcbbd628 100644 --- a/.github/workflows/dev-images.yml +++ b/.github/workflows/dev-images.yml @@ -1,7 +1,9 @@ name: Docker Dev Images Build on: - workflow_dispatch: + push: + branches: + - main jobs: build: @@ -29,7 +31,6 @@ jobs: run: | cp .env.example .env docker build -f Dockerfile.multi --target api-build -t librechat-dev-api . - docker build -f Dockerfile.multi --target prod-stage -t librechat-dev-client . docker build -f Dockerfile -t librechat-dev . # Tag and push the images to GitHub Container Registry @@ -40,11 +41,6 @@ jobs: docker tag librechat-dev-api:latest ghcr.io/${{ github.repository_owner }}/librechat-dev-api:latest docker push ghcr.io/${{ github.repository_owner }}/librechat-dev-api:latest - docker tag librechat-dev-client:latest ghcr.io/${{ github.repository_owner }}/librechat-dev-client:${{ github.sha }} - docker push ghcr.io/${{ github.repository_owner }}/librechat-dev-client:${{ github.sha }} - docker tag librechat-dev-client:latest ghcr.io/${{ github.repository_owner }}/librechat-dev-client:latest - docker push ghcr.io/${{ github.repository_owner }}/librechat-dev-client:latest - docker tag librechat-dev:latest ghcr.io/${{ github.repository_owner }}/librechat-dev:${{ github.sha }} docker push ghcr.io/${{ github.repository_owner }}/librechat-dev:${{ github.sha }} docker tag librechat-dev:latest ghcr.io/${{ github.repository_owner }}/librechat-dev:latest diff --git a/Dockerfile.multi b/Dockerfile.multi index bb290b5885..93310a5a8e 100644 --- a/Dockerfile.multi +++ b/Dockerfile.multi @@ -28,6 +28,5 @@ CMD ["node", "server/index.js"] # Nginx setup FROM nginx:1.21.1-alpine AS prod-stage -COPY --from=client-build /app/client/dist /usr/share/nginx/html COPY ./client/nginx.conf /etc/nginx/conf.d/default.conf CMD ["nginx", "-g", "daemon off;"] diff --git a/client/nginx.conf b/client/nginx.conf index e7fb065705..455979aa16 100644 --- a/client/nginx.conf +++ b/client/nginx.conf @@ -1,5 +1,10 @@ server { listen 80; + # listen 443 ssl; + + # ssl_certificate /etc/nginx/ssl/nginx.crt; + # ssl_certificate_key /etc/nginx/ssl/nginx.key; + server_name localhost; location /api { @@ -7,7 +12,6 @@ server { } location / { - root /usr/share/nginx/html; - try_files $uri $uri/ /index.html; + proxy_pass http://api:3080; } } diff --git a/deploy-compose.yml b/deploy-compose.yml index d6718d11a1..68b9d8af68 100644 --- a/deploy-compose.yml +++ b/deploy-compose.yml @@ -1,6 +1,10 @@ version: "3.8" services: api: + # build: + # context: . + # dockerfile: Dockerfile.multi + # target: api-build image: ghcr.io/danny-avila/librechat-dev-api:latest container_name: LibreChat-API ports: @@ -19,7 +23,11 @@ services: - MEILI_HOST=http://meilisearch:7700 - MEILI_HTTP_ADDR=meilisearch:7700 client: - image: ghcr.io/danny-avila/librechat-dev-client:latest + build: + context: . + dockerfile: Dockerfile.multi + target: prod-stage + container_name: LibreChat-NGINX ports: - 80:80 - 443:443