Consolidate Dockerfiles.

This commit is contained in:
Andrew Ferrier 2014-12-25 19:33:43 +00:00
parent 18e8636d35
commit 039e5ed57b
4 changed files with 19 additions and 19 deletions

View file

@ -4,6 +4,7 @@ RUN /etc/my_init.d/00_regen_ssh_host_keys.sh
CMD ["/sbin/my_init"]
MAINTAINER Andrew Ferrier <andrew.ferrier@example.com>
RUN apt-get update && apt-get install -y git build-essential \
checkinstall \
fontconfig \
gdebi-core \
getmail4 \
@ -15,15 +16,18 @@ RUN apt-get update && apt-get install -y git build-essential \
libxrender1 \
python \
python3-dateutil \
python3-flake8 \
python3-pip \
python3-reportlab \
wget
WORKDIR /tmp
RUN wget http://mirrors.kernel.org/ubuntu/pool/universe/p/pypdf2/python3-pypdf2_1.23+git20141008-1_all.deb
RUN wget http://mirrors.kernel.org/ubuntu/pool/universe/f/freezegun/python3-freezegun_0.1.18-1_all.deb
RUN fakeroot checkinstall --pkgname=python3-pdfminer3k --pkgversion=0.1 -y --fstrans=no --install=no pip3 install pdfminer3k
RUN wget -O wkhtmltox.deb 'http://sourceforge.net/projects/wkhtmltopdf/files/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb/download?use_mirror=garr#'
RUN dpkg -i *.deb
RUN wget -O wkhtmltox.deb 'http://sourceforge.net/projects/wkhtmltopdf/files/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb/download?use_mirror=garr#' && dpkg -i wkhtmltox*.deb
COPY . /tmp/email2pdf/
COPY docker/email2pdf/getmail /etc/cron.d/
WORKDIR /tmp/email2pdf
RUN make builddeb && sh -c 'ls -1 /tmp/email2pdf/*.deb | xargs -L 1 gdebi -n'
RUN make builddeb && sh -c 'ls -1 /tmp/email2pdf/*.deb | xargs -L 1 gdebi -n' && cp /tmp/email2pdf/*.deb /tmp
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /var/tmp/*

View file

@ -14,11 +14,7 @@ builddeb:
fakeroot chmod -R u+x $(TEMPDIR)/usr/bin
fakeroot dpkg-deb --build $(TEMPDIR) .
buildpdfminer3k:
docker build -t "andrewferrier/pdfminer3k" docker/pdfminer3kdeb
docker run -i -v ${PWD}:/pdfminer3k andrewferrier/pdfminer3k sh -c 'cp /tmp/python3-pdfminer3k*.deb /pdfminer3k'
builddocker: buildpdfminer3k
builddocker:
docker build -t andrewferrier/email2pdf .
rundocker_interactive: builddocker
@ -27,6 +23,9 @@ rundocker_interactive: builddocker
rundocker_testing: builddocker
docker run -i -t andrewferrier/email2pdf /sbin/my_init -- bash -c 'cd /tmp/email2pdf && make unittest && make stylecheck'
rundocker_getdebs: builddocker
docker run -i -v ${PWD}:/debs andrewferrier/email2pdf sh -c 'cp /tmp/*.deb /debs'
unittest:
python3 -m unittest discover

View file

@ -53,13 +53,18 @@ Debian package.
There is some experimental packaging for [Docker](https://www.docker.com/)
also. You can run the following `make` targets:
* `builddocker` - build a Docker image.
* `builddocker` - build a Docker image, which can be used for testing,
development, etc.
* `rundocker_interactive` - build and start a Docker image, at the `bash`
prompt.
* `rundocker_unittest` - build and start the Docker image, run the entire unit
test suite, and exit.
* `rundocker_testing` - build and start the Docker image, run the entire unit
testing and style testing suites, and exit.
* `rundocker_getdebs` - build and start the Docker image, and copy out various
`.debs`, including the `.deb` for email2pdf itself, and various dependencies
that are harder to come by or need to be built manually.
## Developing & Hacking
@ -87,7 +92,7 @@ There is a code coverage target in the Makefile. You'll need to have the
* `python3-pdfminer3k` (not a standard Debian/Ubuntu package, but there is a
supplied Makefile target which will create it for you using a Docker
container - run `make buildpdfminer3k`)
container - run `make rundocker_getdebs`)
### OSX

View file

@ -1,8 +0,0 @@
FROM debian:sid
ENV HOME /root
MAINTAINER Andrew Ferrier <andrew.ferrier@example.com>
RUN apt-get update && apt-get install -y \
python3-pip \
checkinstall
WORKDIR /tmp
RUN fakeroot checkinstall --pkgname=python3-pdfminer3k --pkgversion=0.1 -y --fstrans=no --install=no pip3 install pdfminer3k