Skip to content

Commit

Permalink
fix: The api key error fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Suraj-kumar00 committed Aug 11, 2024
1 parent 2cb3146 commit b7dd1de
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 14 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,20 @@ on:
- completed

jobs:

build:

deploy:
runs-on: self-hosted

steps:
- name: Pull Docker image
run: sudo docker pull surajkumar00/ai-customer-support:latest
- name: Delete Old docker container

- name: Delete Old Docker Container
run: sudo docker rm -f ai-customer-support-container || true

- name: Run Docker Container
run: sudo docker run -d -p 3000:3000 --name ai-customer-support-container surajkumar00/ai-customer-support
env:
CLOUDFLARE_API_KEY: ${{ secrets.CLOUDFLARE_API_KEY }} # Pass the API key as an environment variable
run: |
sudo docker run -d -p 3000:3000 \
-e CLOUDFLARE_API_KEY=$CLOUDFLARE_API_KEY \
--name ai-customer-support-container surajkumar00/ai-customer-support
15 changes: 9 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,21 @@ on:
jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Login Dockerhub
env:
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD

- name: Build the Docker image
run: docker build -t surajkumar00/ai-customer-support .
env:
CLOUDFLARE_API_KEY: ${{ secrets.CLOUDFLARE_API_KEY }} # Pass the API key from GitHub secrets
run: docker build --build-arg CLOUDFLARE_API_KEY=$CLOUDFLARE_API_KEY -t surajkumar00/ai-customer-support .

- name: Push to Dockerhub
run: docker push surajkumar00/ai-customer-support
run: docker push surajkumar00/ai-customer-support
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
.yarn/install-state.gz

# Cloudflare API Key:

.env.local

# testing
/coverage
Expand Down
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ RUN npm install
# Copy the rest of the application code
COPY . .

# Copy environment variables file
COPY .env.local .env.local
# Set build arguments
ARG CLOUDFLARE_API_KEY

# Set environment variable
ENV CLOUDFLARE_API_KEY=${CLOUDFLARE_API_KEY}

# Build the Next.js application
RUN npm run build
Expand Down

0 comments on commit b7dd1de

Please sign in to comment.