-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (36 loc) · 1.34 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: Release
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Create .env file
run: |
echo "NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=${{ secrets.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY }}" >> .env
echo "CLERK_SECRET_KEY=${{ secrets.CLERK_SECRET_KEY }}" >> .env
echo "DATABASE_URL=${{ secrets.DATABASE_URL }}" >> .env
echo "STRIPE_API_KEY=${{ secrets.STRIPE_API_KEY }}" >> .env
echo "NEXT_PUBLIC_APP_URL=${{ secrets.NEXT_PUBLIC_APP_URL }}" >> .env
echo "STRIPE_WEBHOOK_SECRET=${{ secrets.STRIPE_WEBHOOK_SECRET }}" >> .env
- name: Build Docker Image
run: docker build -t hrj06/lingo .
- name: Login to Docker Hub
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: Publish Image to Docker Hub
run: docker push hrj06/lingo:latest
deploy:
needs: build
runs-on: self-hosted
steps:
- name: Pull Image from Docker Hub
run: docker pull hrj06/lingo:latest
- name: Delete old container
run: docker rm -f lingo-ec2-container || true
- name: Run Docker container
run: docker run -d -p 3000:3000 --name lingo-ec2-container hrj06/lingo