h3110Fr13nd commited on
Commit
43dfddb
1 Parent(s): 116c6eb

Dockerize the app

Browse files
Files changed (4) hide show
  1. .dockerignore +12 -0
  2. .github/workflows/main.yaml +34 -0
  3. Dockerfile +14 -0
  4. README.md +7 -0
.dockerignore ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ __pycache__
2
+ pragetx_chroma
3
+ *.ipynb
4
+ temp*
5
+ .env
6
+ .venv
7
+ venv
8
+ usercookies
9
+ log*
10
+ pragetx_scraper/data
11
+ Dockerfile
12
+ .dockerignore
.github/workflows/main.yaml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Deploy to EC2
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ deploy:
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - name: Checkout code
14
+ uses: actions/checkout@v2
15
+
16
+ - name: Install SSH Client
17
+ run: sudo apt-get install -y openssh-client
18
+
19
+ - name: Set up SSH
20
+ uses: webfactory/[email protected]
21
+ with:
22
+ ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
23
+
24
+ - name: SSH Command
25
+ run: |
26
+ ssh -o StrictHostKeyChecking=no -i /tmp/deploy-key.pem [email protected] 'cd infinity_talks/ && git pull https://het-vaghasia:${{ secrets.GIT_TOKEN }}@github.com/hetvaghasia39/infinity_talks.git'
27
+ ssh -i /tmp/deploy-key.pem [email protected] 'sudo systemctl stop daphne gunicorn; cd infinity_talks/; source .venv/bin/activate; pip install -r requirements.txt; ./manage.py migrate;'
28
+ ssh -o StrictHostKeyChecking=no -i /tmp/deploy-key.pem [email protected] 'sudo systemctl restart gunicorn'
29
+ ssh -i /tmp/deploy-key.pem [email protected] 'sudo systemctl daemon-reload'
30
+ ssh -i /tmp/deploy-key.pem [email protected] 'sudo systemctl restart gunicorn.socket gunicorn.service'
31
+ ssh -i /tmp/deploy-key.pem [email protected] 'sudo systemctl restart daphne'
32
+ ssh -i /tmp/deploy-key.pem [email protected] 'sudo nginx -t && sudo systemctl restart nginx'
33
+ ssh -i /tmp/deploy-key.pem [email protected] 'sudo systemctl status gunicorn'
34
+ ssh -i /tmp/deploy-key.pem [email protected] 'sudo systemctl status daphne'
Dockerfile ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python
2
+ COPY requirements.txt /app/requirements.txt
3
+ WORKDIR /app
4
+ RUN pip install -r requirements.txt
5
+ RUN playwright install-deps && \
6
+ playwright install
7
+ COPY . /app
8
+ WORKDIR /app/pragetx_scraper
9
+ RUN scrapy crawl pages && \
10
+ cd /app && \
11
+ python setup.py
12
+ WORKDIR /app
13
+ EXPOSE 7860
14
+ CMD ["python", "main.py"]
README.md CHANGED
@@ -2,6 +2,13 @@
2
 
3
  ## Setup
4
 
 
 
 
 
 
 
 
5
  1. Clone the repository:
6
  ```bash
7
  git clone https://github.com/your-username/repo.git
 
2
 
3
  ## Setup
4
 
5
+
6
+ ```bash
7
+ sudo apt install python3-dev
8
+ sudo apt-get install build-essential -y
9
+ ```
10
+
11
+
12
  1. Clone the repository:
13
  ```bash
14
  git clone https://github.com/your-username/repo.git