Skip to content

chore: fix dockerfile #5279

chore: fix dockerfile

chore: fix dockerfile #5279

Workflow file for this run

name: Chat Lucy Node API Production
on:
push:
branches: [master]
paths:
- 'apps/api/**'
- 'packages/**'
- 'config/**'
- 'package.json'
- '.github/workflows/**'
- 'pnpm-workspace.yaml'
- 'pnpm-lock.yaml'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Login docker
run: docker login -u ${{secrets.DOCKER_USERNAME}} -p ${{secrets.DOCKER_PASSWORD}}
- name: Build docker image
run: docker build --build-arg DATABASE_URL="${{secrets.DATABASE_URL}}" -t ${{secrets.DOCKER_USERNAME}}/chat_lucy_node_api:latest -f apps/api/Dockerfile .
- name: Publish image
run: docker push ${{secrets.DOCKER_USERNAME}}/chat_lucy_node_api:latest
deploy:
needs: build
runs-on: [self-hosted,main,prod]
steps:
- name: Remove container
run: docker rm -f chat-lucy-node-api || true
- name: Run docker container chat-lucy-node-api
run: |
docker run -d -p 3333:3333 \
-e NEXT_PUBLIC_APP_URL="${{secrets.NEXT_PUBLIC_APP_URL}}" \
-e NEXT_PUBLIC_API_URL="${{secrets.NEXT_PUBLIC_API_URL}}" \
-e DATABASE_URL="${{secrets.DATABASE_URL}}" \
-e REDIS_URL="${{secrets.REDIS_URL}}" \
-e JWT_SECRET="${{secrets.JWT_SECRET}}" \
-e KAFKA_BROKER="${{secrets.KAFKA_BROKER}}" \
-e KAFKA_USERNAME="${{secrets.KAFKA_USERNAME}}" \
-e KAFKA_PASSWORD="${{secrets.KAFKA_PASSWORD}}" \
-e KAFKA_TOPIC="${{secrets.KAFKA_TOPIC}}" \
--name chat-lucy-node-api \
${{secrets.DOCKER_USERNAME}}/chat_lucy_node_api:latest