Add all supported file extensions and Update Dockerfile to make image smaller by utilizing virtual packages in alpine
This commit is contained in:
parent
03f288c442
commit
8a5cee1d5f
|
@ -1,11 +1,14 @@
|
|||
FROM alpine:latest
|
||||
RUN apk add --no-cache libreoffice py3-pip
|
||||
RUN apk add --no-cache libreoffice
|
||||
RUN apk add font-terminus font-noto font-noto-extra font-arabic-misc font-misc-cyrillic font-mutt-misc font-screen-cyrillic font-winitzki-cyrillic font-cronyx-cyrillic font-noto-arabic font-noto-armenian font-noto-cherokee font-noto-devanagari font-noto-ethiopic font-noto-georgian font-noto-hebrew font-noto-lao font-noto-malayalam font-noto-tamil font-noto-thaana font-noto-thai
|
||||
RUN apk add --no-cache --virtual temporary python3-dev py3-pip gcc libc-dev && pip install --break-system-packages pyrogram TgCrypto && apk del temporary
|
||||
|
||||
|
||||
|
||||
WORKDIR /2pdf
|
||||
|
||||
COPY main.py /2pdf/
|
||||
COPY 2pdf.session /2pdf/
|
||||
RUN pip install --break-system-packages pyrogram
|
||||
|
||||
CMD ["python", "main.py"]
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
# TODO
|
||||
## Planned
|
||||
* Add /start command
|
||||
* Add /replace command
|
||||
* Make every filename random to prevent issues with the same filename
|
||||
|
||||
|
||||
## In progress
|
||||
* Use unoserver
|
21
main.py
21
main.py
|
@ -20,8 +20,25 @@ def validDocument(mime_type):
|
|||
valid_mime_types = [
|
||||
"application/msword", # .doc
|
||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document", # .docx
|
||||
"application/vnd.ms-excel", # xls
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" # .xlsx
|
||||
"application/vnd.ms-excel", # .xls
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", # .xlsx
|
||||
"application/vnd.oasis.opendocument.text", # .odt
|
||||
"application/rtf", # .rtf
|
||||
"text/plain", # .txt
|
||||
"application/xhtml+xml", # .html
|
||||
"application/epub+zip", # .epub
|
||||
"application/vnd.oasis.opendocument.spreadsheet", # .ods
|
||||
"application/vnd.oasis.opendocument.presentation", # .odp
|
||||
"application/vnd.oasis.opendocument.graphics", # .odg
|
||||
"application/vnd.visio", # .vsd
|
||||
"image/svg+xml", # .svg
|
||||
"application/vnd.ms-powerpoint", # .ppt
|
||||
"application/vnd.openxmlformats-officedocument.presentationml.presentation", # .pptx
|
||||
"application/x-abiword", # .abw
|
||||
"application/vnd.ms-works", # .wps
|
||||
"application/x-tex", # .tex
|
||||
"text/csv", # .csv
|
||||
"text/tab-separated-values", # .tsv
|
||||
]
|
||||
return mime_type in valid_mime_types
|
||||
|
||||
|
|
Loading…
Reference in New Issue