(maint) code clean up (#187)
## bdfr - Add the bound instance as method parameter - Change methods not using its bound instance to staticmethods - Fix dangerous default argument - Refactor the comparison involving `not` - Refactor unnecessary `else` / `elif` when `if` block has a `raise` statement - Refactor unnecessary `else` / `elif` when `if` block has a `return` statement - Refactor useless `else` block in the loop - Remove implicit `object` from the base class - Remove reimported module - Remove unnecessary generator - Remove unnecessary return statement - Remove unnecessary use of comprehension - Remove unused imports - Use `is` to compare type of objects - Using not x can cause unwanted results ## Dockerfile - use a pinned Python version tag instead of latest - leverage cached requirements Signed-off-by: Vladislav Doster <mvdoster@gmail.com> Co-authored-by: Ali Parlakçı <parlakciali@gmail.com>
This commit is contained in:
32
Dockerfile
32
Dockerfile
@@ -1,9 +1,31 @@
|
||||
FROM python:latest
|
||||
# Bulk Downloader for Reddit
|
||||
#
|
||||
# VERSION 0.0.1
|
||||
|
||||
FROM python:3.8-slim-buster
|
||||
LABEL Description="This image enables running Buld Downloader for Reddit with in a container environment" Version="0.0.1"
|
||||
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
ENV PYTHONDONTWRITEBYTECODE 1
|
||||
|
||||
WORKDIR "/root/Bulk Downloader for Reddit"
|
||||
COPY ./requirements.txt ./
|
||||
RUN ["pip", "install", "-r", "requirements.txt"]
|
||||
EXPOSE 8080
|
||||
EXPOSE 7634
|
||||
|
||||
CMD ["python", "script.py", "-d", "downloads"]
|
||||
# Install dependencies for building Python packages
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y build-essential \
|
||||
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Requirements are installed here to ensure they will be cached.
|
||||
COPY requirements.txt /requirements.txt
|
||||
RUN pip install --no-cache-dir -r /requirements.txt \
|
||||
&& rm -rf /requirements.txt
|
||||
|
||||
# Copy project files into container
|
||||
COPY . /bdfr
|
||||
WORKDIR /bdfr
|
||||
|
||||
# This is useful because the image name can double as a reference to the binary
|
||||
ENTRYPOINT ["python", "script.py"]
|
||||
CMD ["--help"]
|
||||
|
||||
Reference in New Issue
Block a user