Reputation: 15942
In my docker container, I'm trying to install several packages with pip along with installing Bower via npm. It seems however that whichever of pip or npm run first, the other's contents in /usr/local/bin are overwritten (specifically, gunicorn is missing with the below Dockerfile, or Bower is missing if I swap the order of my FROM..RUN
blocks).
Is this the expected behavior of Docker, and if so, how can I go about installing both my pip packages and Bower into the same directory, /usr/local/bin?
Here's my Dockerfile:
FROM python:3.4.3
RUN mkdir /code
WORKDIR /code
ADD ./requirements/ /code/requirements/
RUN pip install -r /code/requirements/docker.txt
ADD ./ /code/
FROM node:0.12.7
RUN npm install bower
Here's my docker-compose.yml file:
web:
restart: always
build: .
expose:
- "8000"
links:
- postgres:postgres
#-redis:redis
volumes:
- .:/code
env_file: .env
command: /usr/local/bin/gunicorn myapp.wsgi:application -w 2 -b :8000 --reload
webstatic:
restart: always
build: .
volumes:
- /usr/src/app/static
env_file: .env
command: bash -c "/code/manage.py bower install && /code/manage.py collectstatic --noinput"
nginx:
restart: always
#build: ./config/nginx
image: nginx
ports:
- "80:80"
volumes:
- /www/static
- config/nginx/conf.d:/etc/nginx/conf.d
volumes_from:
- webstatic
links:
- web:web
postgres:
restart: always
image: postgres:latest
volumes:
- /var/lib/postgresql
ports:
- "5432:5432"
Update: I went ahead and cross-posted this as a docker-compose issue since it's unclear if there is an actual bug or if my configuration is a problem. I'll keep both posts updated, but do post in either if you have an idea of what is going on. Thanks!
Upvotes: 1
Views: 1354
Reputation: 22680
You cannot use multiple FROM
commands in Dockerfile and you cannot create image from 2 different base images. So if you need node and python in the same image you could either add node to python image or add python to node image.
Upvotes: 3