mirror of
https://github.com/dmunozv04/iSponsorBlockTV.git
synced 2026-01-27 04:40:51 +03:00
Make docker image smaller by caching .pyc and removing .py files
This commit is contained in:
23
Dockerfile
23
Dockerfile
@@ -1,19 +1,28 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
FROM python:3.11-alpine3.19 as compiler
|
||||||
|
|
||||||
FROM python:3.11-alpine
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY src .
|
||||||
|
|
||||||
|
RUN python3 -m compileall -b -f . && \
|
||||||
|
find . -name "*.py" -type f -delete
|
||||||
|
|
||||||
|
FROM python:3.11-alpine3.19
|
||||||
|
|
||||||
ENV PIP_NO_CACHE_DIR=off iSPBTV_docker=True iSPBTV_data_dir=data TERM=xterm-256color COLORTERM=truecolor
|
ENV PIP_NO_CACHE_DIR=off iSPBTV_docker=True iSPBTV_data_dir=data TERM=xterm-256color COLORTERM=truecolor
|
||||||
|
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
|
|
||||||
RUN pip install --upgrade pip wheel && \
|
RUN pip install --upgrade pip wheel && \
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt && \
|
||||||
|
pip uninstall -y pip wheel && \
|
||||||
|
python3 -m compileall -b -f /usr/local/lib/python3.11/site-packages && \
|
||||||
|
find /usr/local/lib/python3.11/site-packages -name "*.py" -type f -delete && \
|
||||||
|
find /usr/local/lib/python3.11/ -name "__pycache__" -type d -exec rm -rf {} +
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN python -m compileall
|
COPY --from=compiler /app .
|
||||||
|
|
||||||
COPY src .
|
ENTRYPOINT ["python3", "-u", "main.pyc"]
|
||||||
|
|
||||||
ENTRYPOINT ["python3", "-u", "main.py"]
|
|
||||||
|
|||||||
Reference in New Issue
Block a user