diff --git a/.github/workflows/ghcr.yaml b/.github/workflows/ghcr.yaml index 086488914..b5baa28ee 100644 --- a/.github/workflows/ghcr.yaml +++ b/.github/workflows/ghcr.yaml @@ -8,26 +8,16 @@ jobs: publish-sarmad-docker-image: runs-on: ubuntu-latest environment: sarmad + env: + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} steps: - uses: actions/checkout@v2 - - name: Login to GitHub Container Registry - - uses: docker/login-action@v1 - + - name: Build and push Docker image + uses: docker/build-push-action@v4 with: - registry: ghcr.io - - username: ${{ github.actor }} - - password: ${{ secrets.GHCR_TOKEN }} - - - name: Build the Sarmad Docker image - - run: | - - docker build . --tag ghcr.io/chatcrm/bizgpt-frontend-2_0:sarmad - - docker run ghcr.io/chatcrm/bizgpt-frontend-2_0:sarmad - - docker push ghcr.io/chatcrm/bizgpt-frontend-2_0:sarmad + context: . + push: true + tags: ghcr.io/chatcrm/bizgpt-frontend-2_0:sarmad + build-args: | + OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} diff --git a/Dockerfile b/Dockerfile index 87f05d228..e86e5ce53 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,9 @@ # Use Node.js 20 as the base image FROM node:20-alpine AS base +ARG OPENAI_API_KEY +ENV OPENAI_API_KEY=$OPENAI_API_KEY + # Install pnpm RUN npm install -g pnpm