Fig deprecated in favor of docker-compose, better Dockerfile

This commit is contained in:
Mathieu Agopian 2015-03-17 15:00:05 +01:00
Родитель d3f0fbe6cc
Коммит 9d4d2ae38f
4 изменённых файлов: 71 добавлений и 53 удалений

Просмотреть файл

@ -1,14 +1,28 @@
FROM python:2.7
RUN apt-get update
RUN apt-get install -y python-dev python-virtualenv libxml2-dev libxslt1-dev libmysqlclient-dev memcached libssl-dev swig openssl curl libjpeg-dev zlib1g-dev libsasl2-dev nodejs npm mysql-client
RUN ln -s /usr/bin/nodejs /usr/bin/node
WORKDIR /code
RUN apt-get update \
&& apt-get install -y \
curl \
libjpeg-dev \
libmysqlclient-dev \
libsasl2-dev \
libssl-dev \
libxml2-dev \
libxslt1-dev \
memcached \
mysql-client \
nodejs \
npm \
python-dev \
python-virtualenv \
swig openssl \
zlib1g-dev \
&& ln -s /usr/bin/nodejs /usr/bin/node
ADD . /code
WORKDIR /code
RUN pip install --no-deps --exists-action=w --download-cache=/tmp/pip-cache \
-r requirements/dev.txt --find-links https://pyrepo.addons.mozilla.org/ \
--src=/pip-src/
RUN pip install --no-deps --exists-action=w --download-cache=/tmp/pip-cache -r requirements/dev.txt --find-links https://pyrepo.addons.mozilla.org/ --src=/pip-src/
RUN pip install --no-deps --exists-action=w --download-cache=/tmp/pip-cache -r requirements/docs.txt --find-links https://pyrepo.addons.mozilla.org/ --src=/pip-src/
RUN npm install
RUN make update_assets

Просмотреть файл

@ -4,9 +4,9 @@ NUM_THEMES=$(NUM_ADDONS)
UNAME_S := $(shell uname -s)
# If you're using docker and fig, you can use this Makefile to run commands in
# your docker images by setting the FIG_PREFIX environment variable to:
# FIG_PREFIX="fig run --rm web"
# If you're using docker and docker-compose, you can use this Makefile to run
# commands in your docker images by setting the DOCKER_PREFIX environment variable
# to: DOCKER_PREFIX="docker-compose run --rm web"
help:
@echo "Please use 'make <target>' where <target> is one of"
@ -27,63 +27,63 @@ help:
@echo "Check the Makefile to know exactly what each target is doing. If you see a "
docs:
$(FIG_PREFIX) $(MAKE) -C docs html
$(DOCKER_PREFIX) $(MAKE) -C docs html
test:
$(FIG_PREFIX) py.test $(ARGS)
$(DOCKER_PREFIX) py.test $(ARGS)
test_es:
$(FIG_PREFIX) py.test -m es_tests $(ARGS)
$(DOCKER_PREFIX) py.test -m es_tests $(ARGS)
test_no_es:
$(FIG_PREFIX) py.test -m "not es_tests" $(ARGS)
$(DOCKER_PREFIX) py.test -m "not es_tests" $(ARGS)
test_force_db:
$(FIG_PREFIX) py.test --create-db $(ARGS)
$(DOCKER_PREFIX) py.test --create-db $(ARGS)
tdd:
$(FIG_PREFIX) py.test -x --pdb $(ARGS)
$(DOCKER_PREFIX) py.test -x --pdb $(ARGS)
test_failed:
$(FIG_PREFIX) py.test --lf $(ARGS)
$(DOCKER_PREFIX) py.test --lf $(ARGS)
initialize_db:
$(FIG_PREFIX) python manage.py reset_db
$(FIG_PREFIX) python manage.py syncdb --noinput
$(FIG_PREFIX) python manage.py loaddata initial.json
$(FIG_PREFIX) python manage.py import_prod_versions
$(FIG_PREFIX) schematic --fake migrations/
$(FIG_PREFIX) python manage.py createsuperuser
$(FIG_PREFIX) python manage.py loaddata zadmin/users
$(DOCKER_PREFIX) python manage.py reset_db
$(DOCKER_PREFIX) python manage.py syncdb --noinput
$(DOCKER_PREFIX) python manage.py loaddata initial.json
$(DOCKER_PREFIX) python manage.py import_prod_versions
$(DOCKER_PREFIX) schematic --fake migrations/
$(DOCKER_PREFIX) python manage.py createsuperuser
$(DOCKER_PREFIX) python manage.py loaddata zadmin/users
populate_data:
$(FIG_PREFIX) python manage.py generate_addons --app firefox $(NUM_ADDONS)
$(FIG_PREFIX) python manage.py generate_addons --app thunderbird $(NUM_ADDONS)
$(FIG_PREFIX) python manage.py generate_addons --app android $(NUM_ADDONS)
$(FIG_PREFIX) python manage.py generate_addons --app seamonkey $(NUM_ADDONS)
$(FIG_PREFIX) python manage.py generate_themes $(NUM_THEMES)
$(FIG_PREFIX) python manage.py reindex --wipe --force
$(DOCKER_PREFIX) python manage.py generate_addons --app firefox $(NUM_ADDONS)
$(DOCKER_PREFIX) python manage.py generate_addons --app thunderbird $(NUM_ADDONS)
$(DOCKER_PREFIX) python manage.py generate_addons --app android $(NUM_ADDONS)
$(DOCKER_PREFIX) python manage.py generate_addons --app seamonkey $(NUM_ADDONS)
$(DOCKER_PREFIX) python manage.py generate_themes $(NUM_THEMES)
$(DOCKER_PREFIX) python manage.py reindex --wipe --force
update_code:
$(FIG_PREFIX) git checkout master && git pull
$(DOCKER_PREFIX) git checkout master && git pull
update_deps:
$(FIG_PREFIX) pip install --no-deps --exists-action=w --download-cache=/tmp/pip-cache -r requirements/dev.txt --find-links https://pyrepo.addons.mozilla.org/wheelhouse/
$(FIG_PREFIX) npm install
$(DOCKER_PREFIX) pip install --no-deps --exists-action=w --download-cache=/tmp/pip-cache -r requirements/dev.txt --find-links https://pyrepo.addons.mozilla.org/wheelhouse/
$(DOCKER_PREFIX) npm install
update_db:
$(FIG_PREFIX) schematic migrations
$(DOCKER_PREFIX) schematic migrations
update_assets:
$(FIG_PREFIX) python manage.py compress_assets
$(FIG_PREFIX) python manage.py collectstatic --noinput
$(DOCKER_PREFIX) python manage.py compress_assets
$(DOCKER_PREFIX) python manage.py collectstatic --noinput
full_init: update_deps initialize_db populate_data update_assets
full_update: update_code update_deps update_db update_assets
reindex:
$(FIG_PREFIX) python manage.py reindex $(ARGS)
$(DOCKER_PREFIX) python manage.py reindex $(ARGS)
flake8:
$(FIG_PREFIX) flake8 --ignore=E265,E266 --exclude=services,wsgi,docs,node_modules,build*.py .
$(DOCKER_PREFIX) flake8 --ignore=E265,E266 --exclude=services,wsgi,docs,node_modules,build*.py .

Просмотреть файл

Просмотреть файл

@ -18,39 +18,43 @@ few easy steps::
git clone git://github.com/mozilla/olympia.git
cd olympia
pip install fig
fig build # Can be very long depending on your internet bandwidth.
fig run web make initialize_db # Create your superuser when asked.
fig up
pip install docker-compose
docker-compose build # Can be very long depending on your internet bandwidth.
docker-compose run web npm install # Install the npm dependencies.
docker-compose run web make update_assets # Compile the css files.
docker-compose run web make initialize_db # Answer yes, and create your superuser when asked.
docker-compose up
# Once it's all loaded, go to http://localhost:8000 and enjoy!
On the last step, if you're using boot2docker, you-ll need to first find its
ip, and connect to that instead::
boot2docker ip
This needs a working installation of docker_, please check the information for
your operating system.
.. _docker: https://docs.docker.com/installation/#installation
All the commands should then be run with the `fig run --rm web` prefix, eg::
All the commands should then be run with the `docker-compose run web`
prefix, eg::
fig run --rm web manage.py test
docker-compose run web py.test
.. note:: If you wish to use the Makefile provided with the environment, you
should first set the `FIG_PREFIX` environment variable::
should first set the `DOCKER_PREFIX` environment variable::
export FIG_PREFIX="fig run --rm web"
export DOCKER_PREFIX="docker-compose run --rm web"
The `make` command will then automatically add the prefix for you!
.. note:: The `--rm` parameter to the `fig run` command will tell fig to remove
the created container straight after being finished with it, to avoid
useless containers packing up after each command.
Please note that any command that would result in files added or modified
outside of the `olympia` folder (eg modifying pip or npm dependencies) won't be
persisted, and so won't survive after the container is finished.
If you need persistence, make sure this command is run in the `Dockerfile` and
do a full rebuild::
fig build
docker-compose build
Installation
------------