-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMPR] Update Dockerfile to Python 3.8
- Use official Python base image instead of building our own from Debian. - Bump to Python 3.8. - Use a smaller base image version, `-slim` (253MB instead of 1.05GB). - Some dev dependencies (`dev-requirements.txt`) like PIL can't be installed in smaller base image, so create a second dockerfile named Dockerfile-dev, that also loads dev-requirements.txt file. - Update CONTENT.rst with new file description. - Set ENTRYPOINT to Pywikibot's pwb.py, with `version` argument if none is specified. - Set PYTHONPATH env var. - Remove MAINTAINER tag, deprecated since Docker 1.13.0 hadolint/hadolint#71. - Use COPY tag instead of ADD to put files in the container. See https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#add-or-copy, Change-Id: I615de3b1cf34b204ae22de2855f0dcfc0a018cd6
- Loading branch information
Showing
3 changed files
with
74 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,54 @@ | ||
The contents of the package | ||
--------------------------- | ||
|
||
+----------------------------------------------------------------------------------+ | ||
| README and config files: | | ||
+===========================+======================================================+ | ||
| CODE_OF_CONDUCT.md | Code of conduct reference | | ||
+---------------------------+------------------------------------------------------+ | ||
| CONTENT.rst | This Content description file | | ||
+---------------------------+------------------------------------------------------+ | ||
| CREDITS | List of major contributors to this module | | ||
+---------------------------+------------------------------------------------------+ | ||
| dev-requirements.txt | PIP requirements file for development dependencies | | ||
+---------------------------+------------------------------------------------------+ | ||
| Dockerfile | assemble an image, install all dependencies via pip | | ||
+---------------------------+------------------------------------------------------+ | ||
| generate_family_file.py | Creates a new family file. | | ||
+---------------------------+------------------------------------------------------+ | ||
| generate_user_files.py | Creates user-config.py or user-fixes.py | | ||
+---------------------------+------------------------------------------------------+ | ||
| HISTORY.rst | pypi version history file | | ||
+---------------------------+------------------------------------------------------+ | ||
| LICENSE | a reference to the MIT license | | ||
+---------------------------+------------------------------------------------------+ | ||
| pwb.py | Wrapper script to use Pywikibot in 'directory' mode | | ||
+---------------------------+------------------------------------------------------+ | ||
| README.rst | Short info string used by Pywikibot Nightlies | | ||
+---------------------------+------------------------------------------------------+ | ||
| README-conversion.txt | Compat to Core branch conversion hints | | ||
+---------------------------+------------------------------------------------------+ | ||
| requirements.txt | General PIP requirements file | | ||
+---------------------------+------------------------------------------------------+ | ||
| ROADMAP.rst | pypi version roadmap file | | ||
+---------------------------+------------------------------------------------------+ | ||
| setup.py | Installer script for Pywikibot framework | | ||
+---------------------------+------------------------------------------------------+ | ||
| tox.ini | Tests config file | | ||
+---------------------------+------------------------------------------------------+ | ||
| user-config.py.sample | Example user-config.py file for reference | | ||
+---------------------------+------------------------------------------------------+ | ||
| user-fixes.py.sample | Example user-fixes.py file for reference | | ||
+---------------------------+------------------------------------------------------+ | ||
+---------------------------------------------------------------------------------------+ | ||
| README and config files: | | ||
+===========================+===========================================================+ | ||
| CODE_OF_CONDUCT.md | Code of conduct reference | | ||
+---------------------------+-----------------------------------------------------------+ | ||
| CONTENT.rst | This Content description file | | ||
+---------------------------+-----------------------------------------------------------+ | ||
| CREDITS | List of major contributors to this module | | ||
+---------------------------+-----------------------------------------------------------+ | ||
| dev-requirements.txt | PIP requirements file for development dependencies | | ||
+---------------------------+-----------------------------------------------------------+ | ||
| Dockerfile | Assemble a Docker image, install all dependencies via pip | | ||
+---------------------------+-----------------------------------------------------------+ | ||
| Dockerfile-dev | Docker image including developement dependencies | | ||
+---------------------------+-----------------------------------------------------------+ | ||
| generate_family_file.py | Creates a new family file | | ||
+---------------------------+-----------------------------------------------------------+ | ||
| generate_user_files.py | Creates user-config.py or user-fixes.py | | ||
+---------------------------+-----------------------------------------------------------+ | ||
| HISTORY.rst | pypi version history file | | ||
+---------------------------+-----------------------------------------------------------+ | ||
| LICENSE | Reference to the MIT license | | ||
+---------------------------+-----------------------------------------------------------+ | ||
| pwb.py | Wrapper script to use Pywikibot in 'directory' mode | | ||
+---------------------------+-----------------------------------------------------------+ | ||
| README.rst | Short info string used by Pywikibot Nightlies | | ||
+---------------------------+-----------------------------------------------------------+ | ||
| README-conversion.txt | Compat to Core branch conversion hints | | ||
+---------------------------+-----------------------------------------------------------+ | ||
| requirements.txt | General PIP requirements file | | ||
+---------------------------+-----------------------------------------------------------+ | ||
| ROADMAP.rst | pypi version roadmap file | | ||
+---------------------------+-----------------------------------------------------------+ | ||
| setup.py | Installer script for Pywikibot framework | | ||
+---------------------------+-----------------------------------------------------------+ | ||
| tox.ini | Tests config file | | ||
+---------------------------+-----------------------------------------------------------+ | ||
| user-config.py.sample | Example user-config.py file for reference | | ||
+---------------------------+-----------------------------------------------------------+ | ||
| user-fixes.py.sample | Example user-fixes.py file for reference | | ||
+---------------------------+-----------------------------------------------------------+ | ||
|
||
+----------------------------------------------------------------------------------+ | ||
| Directories | | ||
+===========================+======================================================+ | ||
| pywikibot | Contains some libraries and control files | | ||
+---------------------------+------------------------------------------------------+ | ||
| scripts | Contains all bots and utility scripts | | ||
+---------------------------+------------------------------------------------------+ | ||
| tests | Some test stuff for the developing team | | ||
+---------------------------+------------------------------------------------------+ | ||
+---------------------------------------------------------------------------------------+ | ||
| Directories | | ||
+===========================+===========================================================+ | ||
| pywikibot | Contains some libraries and control files | | ||
+---------------------------+-----------------------------------------------------------+ | ||
| scripts | Contains all bots and utility scripts | | ||
+---------------------------+-----------------------------------------------------------+ | ||
| tests | Some test stuff for the developing team | | ||
+---------------------------+-----------------------------------------------------------+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,14 @@ | ||
FROM debian:stretch | ||
FROM python:3.8-slim | ||
|
||
MAINTAINER Pywikibot team <[email protected]> | ||
WORKDIR /code | ||
|
||
RUN apt-get update | ||
RUN apt-get install --yes python3.5 python3-pip git libjpeg62-turbo libjpeg62-turbo-dev zlib1g zlib1g-dev locales | ||
COPY requirements.txt . | ||
RUN pip install -r requirements.txt | ||
|
||
# Setup the C.UTF-8 Locale, since otherwise it defaults to an ASCII one | ||
RUN locale-gen C.UTF-8 | ||
ENV LC_ALL C.UTF-8 | ||
COPY . . | ||
RUN pip3 install . | ||
|
||
# TODO: Add this to the default PYTHONPATH and PATH? | ||
ADD . /srv/pwb | ||
ENV PYTHONPATH=/code:/code/scripts | ||
|
||
# pip version in stretch is too old :( | ||
RUN pip3 install -U setuptools | ||
RUN pip3 install -U pip | ||
|
||
RUN pip3 install -r /srv/pwb/requirements.txt | ||
RUN pip3 install -r /srv/pwb/dev-requirements.txt | ||
RUN pip3 install /srv/pwb/ | ||
|
||
CMD /bin/bash | ||
ENTRYPOINT ["python", "/code/pwb.py"] | ||
CMD ["version"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM python:3.8 | ||
|
||
WORKDIR /code | ||
|
||
COPY requirements.txt . | ||
COPY dev-requirements.txt . | ||
RUN pip install -r requirements.txt | ||
RUN pip install -r dev-requirements.txt | ||
|
||
COPY . . | ||
RUN pip3 install . | ||
|
||
ENV PYTHONPATH=/code:/code/scripts | ||
ENTRYPOINT ["python", "/code/pwb.py"] | ||
CMD ["version"] |