Update Dockerfile to use Python3.6 and install from PyPI package

Also update README and CONTRIBUTING guides with the information
on how to build and run Docker image.
This commit is contained in:
Yuri Bochkarev 2018-06-10 01:33:39 +03:00
parent 26d6d332c2
commit ef3268677e
3 changed files with 40 additions and 18 deletions

View file

@ -241,3 +241,21 @@ DRAFT
I think this is required for PyPI description to look nice.
7. `python setup.py sdist` to build the package
8. `twine upload dist/coursera-dl-0.6.1.tar.gz` to deploy the package.
## Docker
Build new Docker image from PyPI package:
```
docker build --tag courseradl/courseradl --build-arg VERSION=0.11.2 .
```
Run the image:
```
docker run --rm -it -v "$(pwd):/courses" -v "$HOME/.netrc:/netrc" courseradl -n /netrc -- google-machine-learning
```
Publish the image:
```
docker push courseradl/courseradl
```

View file

@ -1,21 +1,14 @@
FROM python:3.4-slim
FROM python:3.6-slim
LABEL maintainer "opsxcq@strm.sh"
WORKDIR /src
COPY requirements.txt /src
COPY requirements-dev.txt /src
LABEL maintainer "https://github.com/coursera-dl/"
RUN apt-get update && \
apt-get install -y --no-install-recommends gcc g++ libssl-dev && \
rm -rf /var/lib/apt/lists/* && \
pip install -r requirements.txt && \
pip install -r requirements-dev.txt && \
apt-get purge -y --auto-remove gcc g++ libssl-dev
COPY . /src
RUN python setup.py install
ARG VERSION
RUN pip install coursera-dl==$VERSION
WORKDIR /courses
ENTRYPOINT ["coursera-dl"]

View file

@ -220,26 +220,37 @@ applicable).
If you prefer you can run this software inside Docker:
```
docker run --rm -it \
-v "$(pwd):/courses" \
strm/coursera-dl \
-u <USER> -p <PASSWORD>
docker run --rm -it -v \
"$(pwd):/courses" \
courseradl/courseradl -u <USER> -p <PASSWORD>
```
The actual working dir for coursera-dl is /courses, all courses will be downloaded there if you don't specify otherwise.
Or using netrc file:
```
docker run --rm -it \
-v "$(pwd):/courses" -v "$HOME/.netrc:/netrc" \
courseradl/courseradl -n /netrc
```
The actual working dir for coursera-dl is /courses, all courses will be
downloaded there if you don't specify otherwise.
## Windows
`python -m pip install coursera-dl`
Be sure that the Python install path is added to the PATH system environment variables. This can be found in Control Panel > System > Advanced System Settings > Environment Variables.
Be sure that the Python install path is added to the PATH system environment
variables. This can be found in Control Panel > System > Advanced System
Settings > Environment Variables.
```
Example:
C:\Python35\Scripts\;C:\Python35\;
```
Or if you have restricted installation permissions and you've installed Python under AppData, add this to your PATH.
Or if you have restricted installation permissions and you've installed Python
under AppData, add this to your PATH.
```
Example: