GrahamDumpleton / mod_wsgi-docker

Docker images for Apache/mod_wsgi.
Apache License 2.0
72 stars 36 forks source link

pre-build hook being ignored? #1

Closed hkraal closed 9 years ago

hkraal commented 9 years ago

This docker images seems awsome, thank you for sharing! I'm assuming I'm the one to fail here but I'm not sure where it's going wrong. I'm trying to dockerize an Django application which requires MySQL-python. This fails as libmysqlclient-dev is missing.

To set this straight I created an .docker/action_hooks/pre-build file which should be called before the pip install part in build.sh, it however doesn't as I don't see the expected echo " -----> Running .whiskey/action_hooks/pre-build output and the error remains the same.

What am I missing here.

$ docker build -t my-app .

Sending build context to Docker daemon 608.3 kB
Sending build context to Docker daemon 
Step 0 : FROM grahamdumpleton/mod-wsgi-docker:python-2.7-onbuild
# Executing 2 build triggers
Trigger 0, COPY . /app
Step 0 : COPY . /app
 ---> Using cache
Trigger 1, RUN mod_wsgi-docker-build
Step 0 : RUN mod_wsgi-docker-build
 ---> Running in 206694174a14
 -----> Installing dependencies with pip
...

$ cat Dockerfile:

FROM grahamdumpleton/mod-wsgi-docker:python-2.7-onbuild
CMD [ "webtool/wsgi.py" ]

$ cat requirements.txt:

Django<1.8
requests
MySQL-python

$ cat .docker/action_hooks/pre-build:

#!/usr/bin/env bash

set -eo pipefail

apt-get update
apt-get install -y libmysqlclient-dev

rm -r /var/lib/apt/lists/* 

$ stat .docker/action_hooks/pre-build

Access: (0755/-rwxr-xr-x)  Uid: ( 1000/  user)   Gid: ( 1000/  user)
GrahamDumpleton commented 9 years ago

Will check properly later, but use:

.whiskey/action_hooks/pre-build

and make sure is executable.

The name of the sub directory changed but it looks like I stuffed up the backwards compatibility stuff for on-build so old path still worked.

In other words, rather than a '.docker' subdirectory, use '.whiskey' subdirectory.

hkraal commented 9 years ago

That works like a charm, the pre-build script is being picked up correctly now. Thank you very much for sharing!

GrahamDumpleton commented 9 years ago

I believe I have fixed and regenerated the docker images now. The newer images also use latest Apache and mod_wsgi versions.