adds docker deployment

This commit is contained in:
TheBeastLT
2020-03-26 18:34:29 +01:00
parent 0e802c74d2
commit 6244208ed6
6 changed files with 63 additions and 46 deletions

View File

@@ -1,28 +0,0 @@
name: Deploy Pipeline
on:
push:
branches:
- 'master'
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: sed -i -e "s~@database-uri~$DATABASE_URI~g" app.yaml
env:
DATABASE_URI: ${{secrets.DATABASE_URI}}
- run: sed -i -e "s~@mongodb-uri~$MONGODB_URI~g" app.yaml
env:
MONGODB_URI: ${{secrets.MONGODB_URI}}
- uses: actions-hub/gcloud@master
env:
PROJECT_ID: ${{secrets.GCLOUD_PROJECT_ID}}
APPLICATION_CREDENTIALS: ${{secrets.GOOGLE_APPLICATION_CREDENTIALS}}
with:
args: app -q deploy app.yaml --promote

42
.github/workflows/deploy.yml vendored Normal file
View File

@@ -0,0 +1,42 @@
name: Deploy
on:
push:
branches: master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Create Docker image
run: |
docker build -t torrentio-addon:latest ./addon/
docker save torrentio-addon:latest > torrentio_addon_latest.tar
- name: Upload Docker image
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
port: ${{ secrets.SSH_PORT }}
key: ${{ secrets.SSH_KEY }}
source: torrentio_addon_latest.tar
target: /tmp/docker
overwrite: true
- name: Deploy Docker image
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
port: ${{ secrets.SSH_PORT }}
key: ${{ secrets.SSH_KEY }}
script: |
docker load -i /tmp/docker/torrentio_addon_latest.tar
docker stop torrentio-addon
docker rm torrentio-addon
docker run -p 80:7000 -d --name torrentio-addon --restart always -e MONGODB_URI=${{ secrets.MONGODB_URI }} -e DATABASE_URI=${{ secrets.DATABASE_URI }} -e RESOLVER_HOST=${{ secrets.RESOLVER_HOST }} torrentio-addon:latest
docker image prune -f

3
addon/.dockerignore Normal file
View File

@@ -0,0 +1,3 @@
node_modules
npm-debug.log
**/.env

12
addon/Dockerfile Normal file
View File

@@ -0,0 +1,12 @@
FROM node:12-alpine
RUN apk update && apk upgrade && \
apk add --no-cache git
WORKDIR /home/node/app
COPY package*.json ./
RUN npm ci --only-production
COPY . .
CMD [ "node", "index.js" ]

View File

@@ -12,9 +12,9 @@ function manifest({ providers, realdebrid } = {}) {
const realDebridDesc = realdebrid ? ' and RealDebrid enabled' : '';
return {
id: 'com.stremio.torrentio.addon',
version: '0.0.1-beta',
version: '0.0.2',
name: 'Torrentio',
description: '[BETA] Provides torrent streams from scraped torrent providers.'
description: 'Provides torrent streams from scraped torrent providers.'
+ ` ${providersDesc} ${providersList.join(', ')}${realDebridDesc}.`
+ ' To configure providers, RealDebrid support and other settings visit www.torrentio.now.sh',
catalogs: [],

View File

@@ -1,28 +1,16 @@
{
"version": 2,
"builds": [
{
"src": "/addon/**/*.js",
"use": "@now/node"
}
],
"routes": [
{
"src": "/static/(.*)",
"dest": "/addon/static/$1"
},
{
"src": "/(.*)",
"dest": "/addon/serverless.js"
"status": 308,
"headers": {
"Location": "https://torrentio.strem.fun/$1"
}
}
],
"github": {
"silent": true
},
"env": {
"MONGODB_URI": "@mongodb-uri",
"DATABASE_URI": "@database-uri",
"RESOLVER_HOST": "@torrentio-resolver-host"
}
}