Shrinking the container even more, using cmagick + imagemagick to do iamge conversions
This commit is contained in:
parent
d7f16e8afa
commit
9fa1e2437b
@ -1,9 +1,9 @@
|
|||||||
FROM python:3.8 as build
|
FROM python:3.8 as build
|
||||||
ADD app/requirements.txt /requirements.txt
|
ADD app/requirements.txt /requirements.txt
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends libmagickwand-dev && pip install --no-cache-dir -q -r requirements.txt
|
RUN pip install --no-cache-dir -q -r requirements.txt
|
||||||
|
|
||||||
FROM python:3.8-slim
|
FROM python:3.8-slim
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends libmagickwand-dev \
|
RUN apt-get update && apt-get install -y --no-install-recommends imagemagick \
|
||||||
&& apt-get autoremove -y \
|
&& apt-get autoremove -y \
|
||||||
&& apt-get purge -y --auto-remove \
|
&& apt-get purge -y --auto-remove \
|
||||||
&& rm -rf /var/lib/apt/lists/* /root
|
&& rm -rf /var/lib/apt/lists/* /root
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
FROM python:3.8 as build
|
FROM python:3.8 as build
|
||||||
ADD app/requirements.txt /requirements.txt
|
ADD app/requirements.txt /requirements.txt
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends libmagickwand-dev && pip install --no-cache-dir -q -r requirements.txt
|
RUN pip install --no-cache-dir -q -r requirements.txt
|
||||||
|
|
||||||
FROM python:3.8-slim
|
FROM python:3.8-slim
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends libmagickwand-dev
|
RUN apt-get update && apt-get install -y --no-install-recommends imagemagick
|
||||||
COPY --from=0 /usr/local/lib/python3.8/site-packages /usr/local/lib/python3.8/site-packages
|
COPY --from=0 /usr/local/lib/python3.8/site-packages /usr/local/lib/python3.8/site-packages
|
||||||
ADD app /app
|
ADD app /app
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
@ -77,7 +77,7 @@ async def based(ctx):
|
|||||||
|
|
||||||
@bot.listen("on_message")
|
@bot.listen("on_message")
|
||||||
async def convert_heic_to_jpg(ctx):
|
async def convert_heic_to_jpg(ctx):
|
||||||
from wand.image import Image
|
from cmagick import cmagick
|
||||||
|
|
||||||
if ctx.attachments:
|
if ctx.attachments:
|
||||||
for attachment in ctx.attachments:
|
for attachment in ctx.attachments:
|
||||||
@ -86,11 +86,8 @@ async def convert_heic_to_jpg(ctx):
|
|||||||
jpg_file = "/tmp/converted.jpg"
|
jpg_file = "/tmp/converted.jpg"
|
||||||
await attachment.save(fp=source_file)
|
await attachment.save(fp=source_file)
|
||||||
|
|
||||||
# Convert to jpg
|
img = cmagick.convert(source_file, jpg_file)
|
||||||
img = Image(filename=source_file)
|
|
||||||
img.format = "jpg"
|
|
||||||
img.save(filename=jpg_file)
|
|
||||||
img.close()
|
|
||||||
try:
|
try:
|
||||||
await ctx.delete()
|
await ctx.delete()
|
||||||
except Exception:
|
except Exception:
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
beautifulsoup4
|
beautifulsoup4
|
||||||
|
cmagick
|
||||||
discord.py
|
discord.py
|
||||||
gTTS
|
gTTS
|
||||||
lxml
|
lxml
|
||||||
|
owotext
|
||||||
pandas
|
pandas
|
||||||
requests
|
requests
|
||||||
owotext
|
|
||||||
wikipedia
|
wikipedia
|
||||||
wolframalpha
|
wolframalpha
|
||||||
Wand
|
|
Loading…
x
Reference in New Issue
Block a user