-
Notifications
You must be signed in to change notification settings - Fork 1
40 lines (34 loc) · 1.17 KB
/
main_summarize-me.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
40
name: CI-CD
on:
push:
branches: [ "main" ] # or your production branch
jobs:
build-and-deploy:
runs-on: self-hosted
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up Docker buildx
uses: docker/setup-buildx-action@v2
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.CR_PAT }}
- name: Build and push Docker image
run: |
docker build -t ghcr.io/${{ github.repository }}:latest .
docker push ghcr.io/${{ github.repository }}:latest
- name: Deploy container
run: |
# Pull the newest image
docker pull ghcr.io/${{ github.repository }}:latest
# Stop old container (if running)
docker stop summarizeme.io || true
docker rm summarizeme.io || true
# Run new container
docker run -d --name summarizeme.io \
--env-file=/home/satsur/.env \
-p 8000:8000 \
ghcr.io/${{ github.repository }}:latest