-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug 1304101: Split Dockerfile into dev+prod version (#131). r=rail,jl…
…orenzo
- Loading branch information
Showing
12 changed files
with
147 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# NOTE: The only supported way to use the Balrog dev image is with a volume mount of /app. | ||
# Because of this, the only things we do in the Dockerfile are install things to | ||
# system locations (some system packages and some python packages). | ||
# Things that are fully local to /app (such as npm requirements and the built UI) | ||
# are done as needed in the entrypoint. | ||
FROM python:2.7-slim | ||
|
||
MAINTAINER bhearsum@mozilla.com | ||
|
||
# Some versions of the python:2.7 Docker image remove libpcre3, which uwsgi needs for routing support to be enabled. | ||
# Node and npm are to build the frontend. nodejs-legacy is needed by this version of npm. | ||
# mysql-client is needed to import sample data | ||
# libmysqlclient-dev is required to use SQLAlchemy with MySQL, which we do in production. | ||
# libfontconfig1 is required by phantomjs | ||
RUN apt-get -q update \ | ||
&& apt-get -q --yes install libpcre3 libpcre3-dev nodejs nodejs-legacy npm libmysqlclient-dev mysql-client \ | ||
libfontconfig1 \ | ||
&& apt-get clean | ||
|
||
WORKDIR /app | ||
|
||
# The general app requirements and packages required to run Tox are installed into the system, | ||
# so we need to include them as part of the Docker build. | ||
# TODO: edit this comment | ||
COPY ./ /app/ | ||
# install the requirements into the container first | ||
# these rarely change and is more cache friendly | ||
# ... really speeds up building new containers | ||
RUN pip install -r requirements.txt | ||
RUN pip install -r requirements-tox.txt | ||
|
||
# Using /bin/bash as the entrypoint works around some volume mount issues on Windows | ||
# where volume-mounted files do not have execute bits set. | ||
# https://github.com/docker/compose/issues/2301#issuecomment-154450785 has additional background. | ||
ENTRYPOINT ["/bin/bash", "/app/scripts/run.sh"] | ||
CMD ["public"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
balrogtest: | ||
build: . | ||
entrypoint: | ||
- /app/scripts/test-entrypoint.sh | ||
dockerfile: Dockerfile.dev | ||
command: test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,22 @@ | ||
tox==2.3.1 \ | ||
# --hash=sha256:bf7fcc140863820700d3ccd65b33820ba747b61c5fe4e2b91bb8c64cb21a47ee | ||
pluggy==0.3.1 \ | ||
# --hash=sha256:159cc783e056c07da6552aa5aef6b1e6c0064b4f18bd49c531fd2d40aafb0ea3 | ||
py==1.4.31 \ | ||
# --hash=sha256:a6501963c725fc2554dabfece8ae9a8fb5e149c0ac0a42fd2b02c5c1c57fc114 | ||
virtualenv==15.0.1 \ | ||
# --hash=sha256:1a74278b8adb383ce4c7619e33c753b1eb7b58dc1e449601c096ca4b76125f84 | ||
certifi==2016.8.31 \ | ||
# --hash=sha256:f7708a42d86f29ccc7c8c4ff9d34a8d854d8d78eb2973d1f28406bb43d6b8919 | ||
coverage==4.2 \ | ||
# --hash=sha256:e312776d3ef04632ec742ce2d2b7048b635073e0245e4f44dfe8b08cc50ac656 | ||
flake8==3.0.4 \ | ||
# --hash=sha256:b4c210c998f07d6ff24325dd91fbc011f2c37bcd6bf576b188de01d8656e970d | ||
mock==2.0.0 \ | ||
# --hash=sha256:b158b6df76edd239b8208d481dc46b6afd45a846b7812ff0ce58971cf5bc8bba | ||
ordereddict==1.1 \ | ||
# --hash=sha256:1c35b4ac206cef2d24816c89f89cf289dd3d38cf7c449bb3fab7bf6d43f01b1f | ||
paste==2.0.3 \ | ||
# --hash=sha256:2346a347824c32641bf020c17967b49ae74d3310ec1bc9b958d4b84e2d985218 | ||
pyflakes==1.3.0 \ | ||
# --hash=sha256:a4f93317c97a9d9ed71d6ecfe08b68e3de9fea3f4d94dcd1d9d83ccbf929bc31 | ||
pytest==3.0.2 \ | ||
# --hash=sha256:64d8937626dd2a4bc15ef0edd307d26636a72a3f3f9664c424d78e40efb1e339 | ||
pytest-catchlog==1.2.2 \ | ||
# --hash=sha256:4be15dc5ac1750f83960897f591453040dff044b5966fe24a91c2f7d04ecfcf0 | ||
pytest-cov==2.3.1 \ | ||
# --hash=sha256:fa0a212283cdf52e2eecc24dd6459bb7687cc29adb60cb84258fab73be8dda0f | ||
pytest-xdist==1.15.0 \ | ||
# --hash=sha256:6238395f8bd050f9288a3b10f34330edece80f4424cf2b4204d6e7d622f0f00b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
pluggy==0.3.1 \ | ||
# --hash=sha256:159cc783e056c07da6552aa5aef6b1e6c0064b4f18bd49c531fd2d40aafb0ea3 | ||
py==1.4.31 \ | ||
# --hash=sha256:a6501963c725fc2554dabfece8ae9a8fb5e149c0ac0a42fd2b02c5c1c57fc114 | ||
tox==2.3.1 \ | ||
# --hash=sha256:bf7fcc140863820700d3ccd65b33820ba747b61c5fe4e2b91bb8c64cb21a47ee | ||
virtualenv==15.0.1 \ | ||
# --hash=sha256:1a74278b8adb383ce4c7619e33c753b1eb7b58dc1e449601c096ca4b76125f84 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
set -xe | ||
|
||
apt-get -q update | ||
apt-get -q --yes install mysql-client | ||
apt-get clean | ||
|
||
if [ ! -e /app/.cache/mysql/db.done ]; then | ||
sleep 30 | ||
# We need to sleep awhile for fresh databases because mysql will take longer to initialize. | ||
# Ideally, this would find some better way to probe for mysql-readyness. | ||
sleep 45 | ||
echo "Initializing DB..." | ||
python scripts/manage-db.py -d mysql://balrogadmin:balrogadmin@balrogdb/balrog create | ||
bunzip2 -c /app/scripts/sample-data.sql.bz2 | mysql -h balrogdb -u balrogadmin --password=balrogadmin balrog | ||
mysql -h balrogdb -u balrogadmin --password=balrogadmin -e "insert into permissions (username, permission, data_version) values (\"balrogadmin\", \"admin\", 1)" balrog | ||
touch /app/.cache/mysql/db.done | ||
echo "Done" | ||
else | ||
# We also should sleep for existing databases, but we don't need for nearly as long. | ||
sleep 10 | ||
python scripts/manage-db.py -d mysql://balrogadmin:balrogadmin@balrogdb/balrog upgrade | ||
fi | ||
|
||
# run the command passed from docker | ||
/app/uwsgi/run.sh $@ | ||
/app/scripts/run.sh $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d75baaf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TaskCluster-GitHub: https://tools.taskcluster.net/task-graph-inspector/#F6ZxyxNQRwO0JyYtwyM8dQ