Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Commit

Permalink
Setup css/js dependencies inside dockerfile.
Browse files Browse the repository at this point in the history
  • Loading branch information
hannosch committed Dec 1, 2015
1 parent faae9b4 commit 0b0175f
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 36 deletions.
5 changes: 5 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"analytics": false,
"interactive": false,
"strict-ssl": true
}
9 changes: 6 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
.*
.DS_Store
.coverage
.tox

*~
*.egg-info
*.log
Expand All @@ -9,13 +12,12 @@ coverage.xml
nosetests.xml
pip-selfcheck.json
pyvenv.cfg

bin/
bower_components/
build/
coverage/
data/
datamaps/
docker/
dist/
docs/build/doctrees/
docs/build/html/
Expand All @@ -33,6 +35,7 @@ shapely/
src/

# only works in docker 1.10+
**/.DS_Store
**/*.py[co]
**/*.so

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ coverage/
datamaps/
dist/
docs/build/doctrees/
docker/python/.bowerrc
docker/python/*.json
docker/python/*.txt
ichnaea/content/static/tiles/
include/
lib/
Expand Down
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mozilla-ichnaea/python:latest
FROM mozilla-ichnaea/python
MAINTAINER Mozilla Geolocation <dev-geolocation@lists.mozilla.org>
ENV PYTHONUNBUFFERED 1

Expand All @@ -9,6 +9,10 @@ RUN bin/pip install --no-cache-dir --no-deps --disable-pip-version-check \
RUN bin/pip install --no-cache-dir --no-deps --disable-pip-version-check \
-r requirements/dev.txt
COPY . /data/ichnaea

RUN make css
RUN make js

RUN bin/cython ichnaea/geocalc.pyx
RUN bin/python setup.py install

Expand Down
17 changes: 7 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ endif

docker-images-dev:
cd docker/os; docker build -t mozilla-ichnaea/os:latest .
cp requirements/prod-slow.txt docker/python/
cp .bowerrc docker/python/
cp bower.json docker/python/
cp npm-shrinkwrap.json docker/python/
cp package.json docker/python/
cd docker/python; docker build -t mozilla-ichnaea/python:latest .
docker build -t mozilla-ichnaea/dev:latest .

Expand Down Expand Up @@ -198,15 +203,7 @@ node_modules:
bower: node_modules
$(BOWER) install

css: bower
cp $(BOWER_ROOT)/bedrock/media/fonts/OpenSans* $(FONT_ROOT)/
cp $(BOWER_ROOT)/bedrock/media/img/sandstone/bg-stone.png $(IMG_ROOT)/
cp $(BOWER_ROOT)/bedrock/media/img/sandstone/footer-mozilla.png \
$(IMG_ROOT)/mozilla-logo.png
cp $(BOWER_ROOT)/bedrock/media/img/sandstone/footer-mozilla-high-res.png \
$(IMG_ROOT)/mozilla-logo@2x.png
cp $(BOWER_ROOT)/bedrock/media/img/sandstone/menu-current.png $(IMG_ROOT)/

css:
cp $(BOWER_ROOT)/mozilla-tabzilla/css/tabzilla.css $(CSS_ROOT)/
mkdir -p $(CSS_ROOT)/../media/img/
cp $(BOWER_ROOT)/mozilla-tabzilla/media/img/* $(CSS_ROOT)/../media/img/
Expand All @@ -223,7 +220,7 @@ css: bower
cp -R $(BOWER_ROOT)/mapbox.js/images/*.png $(CSS_ROOT)/images/
$(CLEANCSS) -o bundle-map.css font-awesome.css mapbox.uncompressed.css

js: bower
js:
$(UGLIFYJS) \
privacy.js \
-o bundle-privacy.js -c --stats \
Expand Down
3 changes: 1 addition & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"leaflet.locatecontrol": "0.45.1",
"leaflet-hash": "mlevans/leaflet-hash#d73fc84d8c",
"mapbox.js": "2.2.3",
"mozilla-tabzilla": "0.5.1",
"bedrock": "mozilla/bedrock#cca786298f"
"mozilla-tabzilla": "0.5.1"
}
}
27 changes: 27 additions & 0 deletions docker/os/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,33 @@ WORKDIR /data/pngquant
RUN tar -xf ../pngquant.tar.gz --strip-components=1
RUN ./configure; make; make install

# install current version of node.js/npm based on:
# https://github.com/nodejs/docker-node/blob/master/5.1/Dockerfile

# gpg keys listed at https://github.com/nodejs/node
RUN set -ex \
&& for key in \
9554F04D7259F04124DE6B476D5A82AC7E37093B \
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
0034A06D9D9B0064CE8ADF6BF1747F4AD2306D93 \
FD3A5288F042B6850C66B31F09FE44734EB7990E \
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
; do \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
done

ENV NPM_CONFIG_LOGLEVEL warn
ENV NODE_VERSION 5.1.0

WORKDIR /data
RUN curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz" \
&& curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
&& gpg --verify SHASUMS256.txt.asc \
&& grep " node-v$NODE_VERSION-linux-x64.tar.gz\$" SHASUMS256.txt.asc | sha256sum -c - \
&& tar -xzf "node-v$NODE_VERSION-linux-x64.tar.gz" -C /usr/local --strip-components=1 \
&& rm "node-v$NODE_VERSION-linux-x64.tar.gz" SHASUMS256.txt.asc

WORKDIR /data
RUN ldconfig

Expand Down
10 changes: 9 additions & 1 deletion docker/python/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mozilla-ichnaea/os:latest
FROM mozilla-ichnaea/os
MAINTAINER Mozilla Geolocation <dev-geolocation@lists.mozilla.org>
ENV PYTHONUNBUFFERED 1

Expand All @@ -8,4 +8,12 @@ COPY prod-slow.txt requirements/prod-slow.txt
RUN bin/pip install --no-cache-dir --no-deps --disable-pip-version-check \
-r requirements/prod-slow.txt

WORKDIR /data/ichnaea
COPY package.json npm-shrinkwrap.json ./
RUN npm install -d $(pwd); npm dedupe; npm shrinkwrap --dev

ENV PATH $PATH:/data/ichnaea/node_modules/.bin/
COPY bower.json .bowerrc ./
RUN bower --allow-root install

CMD ["bash"]
19 changes: 0 additions & 19 deletions docker/python/prod-slow.txt

This file was deleted.

0 comments on commit 0b0175f

Please sign in to comment.