Skip to content

Commit ef9e89d

Browse files
committed
Add robots.txt & Docker support
1 parent 9c0267d commit ef9e89d

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

Dockerfile

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM python:3.10-alpine AS build
2+
RUN apk add build-base python3-dev linux-headers pcre-dev jpeg-dev zlib-dev
3+
RUN pip install --upgrade pip
4+
RUN pip install uwsgi
5+
6+
FROM python:3.10-alpine AS deps
7+
WORKDIR /vxtiktok
8+
COPY requirements.txt requirements.txt
9+
COPY --from=build /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages
10+
RUN pip install -r requirements.txt
11+
12+
FROM python:3.10-alpine AS runner
13+
EXPOSE 9000
14+
RUN apk add pcre-dev jpeg-dev zlib-dev
15+
WORKDIR /vxtiktok
16+
CMD ["uwsgi", "vxtiktok.ini"]
17+
COPY --from=build /usr/local/bin/uwsgi /usr/local/bin/uwsgi
18+
COPY --from=deps /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages
19+
COPY . .

vxtiktok.ini

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ module = wsgi:app
44
master = true
55
processes = 5
66

7-
socket = /tmp/vxtiktok.sock
8-
chmod-socket = 660
7+
#socket = /tmp/vxtiktok.sock # uncomment if using UNIX socket (NGINX)
8+
#chmod-socket = 660 # uncomment if using UNIX socket (NGINX)
9+
http = 0.0.0.0:9000 # uncomment if using HTTP
910
vacuum = true
1011

1112
die-on-term = true

vxtiktok.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from urllib.parse import quote, urljoin, urlparse
22
import urllib.parse
33
from flask import Flask, render_template, request, redirect, send_file, abort
4-
from yt_dlp import YoutubeDL
54
from flask_cors import CORS
65
import json
76
import cache
@@ -186,6 +185,10 @@ def embed_tiktok(post_link):
186185
def main():
187186
return redirect(config.currentConfig["MAIN"]["repoURL"])
188187

188+
@app.route('/robots.txt')
189+
def robots():
190+
return "User-agent: *\nDisallow: /"
191+
189192
@app.route('/vid/<author>/<vid>')
190193
def video(author, vid):
191194
if vid.endswith(".mp4"):

0 commit comments

Comments
 (0)