-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
150 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
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,17 @@ | ||
{ | ||
"AWSEBDockerrunVersion": 2, | ||
"containerDefinitions": [ | ||
{ | ||
"name": "fabrik-app", | ||
"image": "<AWS_ACCOUNT_ID>.dkr.ecr.us-west-2.amazonaws.com/cloudcv/fabrik:latest", | ||
"essential": true, | ||
"memory": 512, | ||
"portMappings": [ | ||
{ | ||
"hostPort": 8000, | ||
"containerPort": 8000 | ||
} | ||
] | ||
} | ||
] | ||
} |
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,11 @@ | ||
version: "2" | ||
services: | ||
app: | ||
container_name: fabrik | ||
host_name: fabrik | ||
build: | ||
context: . | ||
dockerfile: docker/prod/Dockerfile | ||
command: docker/prod/container-start.sh | ||
ports: | ||
- "8000:8000" |
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,37 @@ | ||
BRANCH="master" | ||
SHA=`git rev-parse --verify HEAD` | ||
|
||
if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_BRANCH" != "$BRANCH" ]; then | ||
echo "Skipping deploy to production server; The request or commit is not on master" | ||
exit 0 | ||
fi | ||
|
||
VERSION=$BRANCH-$SHA | ||
ZIP=$VERSION.zip | ||
|
||
aws configure set default.region us-west-2 | ||
# Authenticate against our Docker registry | ||
eval $(aws ecr get-login) | ||
|
||
# Build and push the image | ||
docker build -t cloudcv/fabrik -f docker/prod/Dockerfile . | ||
docker tag cloudcv/fabrik:latest $AWS_ACCOUNT_ID.dkr.ecr.us-west-2.amazonaws.com/cloudcv/fabrik:latest | ||
docker push $AWS_ACCOUNT_ID.dkr.ecr.us-west-2.amazonaws.com/cloudcv/fabrik:latest | ||
|
||
cd aws/prod | ||
|
||
# Replace the <AWS_ACCOUNT_ID> with the real ID | ||
sed -i='' "s/<AWS_ACCOUNT_ID>/$AWS_ACCOUNT_ID/" Dockerrun.aws.json | ||
|
||
# Zip up the Dockerrun file and .ebextensions directory with it | ||
zip -r $ZIP Dockerrun.aws.json | ||
|
||
aws s3 cp $ZIP s3://$EB_BUCKET/$ZIP | ||
|
||
# Create a new application version with the zipped up Dockerrun file | ||
aws elasticbeanstalk create-application-version --application-name $APPLICATION \ | ||
--version-label $VERSION --source-bundle S3Bucket=$EB_BUCKET,S3Key=$ZIP | ||
|
||
# Update the environment to use the new application version | ||
aws elasticbeanstalk update-environment --environment-name $ENVIRONMENT \ | ||
--version-label $VERSION |
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,75 @@ | ||
FROM node:6 | ||
|
||
RUN mkdir -p /code | ||
WORKDIR /code | ||
ENV PYTHONUNBUFFERED 1 | ||
|
||
COPY package.json /code | ||
RUN npm install | ||
RUN npm install -g webpack | ||
|
||
# Install Python. | ||
RUN \ | ||
apt-get update && \ | ||
apt-get install -y python python-dev python-pip python-virtualenv && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Install dependencies | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
build-essential \ | ||
cmake \ | ||
git \ | ||
unzip \ | ||
wget \ | ||
libatlas-base-dev \ | ||
libboost-all-dev \ | ||
libgflags-dev \ | ||
libgoogle-glog-dev \ | ||
libhdf5-serial-dev \ | ||
libleveldb-dev \ | ||
liblmdb-dev \ | ||
libopencv-dev \ | ||
libprotobuf-dev \ | ||
libsnappy-dev \ | ||
protobuf-compiler \ | ||
python-dev \ | ||
python-numpy \ | ||
python-pip \ | ||
python-setuptools \ | ||
python-scipy && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Install Caffe | ||
RUN cd /root &&\ | ||
wget https://github.com/BVLC/caffe/archive/25391bf9e0552740af8253c6d6fd484297889a49.zip &&\ | ||
unzip -o 25391bf9e0552740af8253c6d6fd484297889a49.zip &&\ | ||
rm 25391bf9e0552740af8253c6d6fd484297889a49.zip && \ | ||
mv caffe-25391bf9e0552740af8253c6d6fd484297889a49 caffe &&\ | ||
cd caffe &&\ | ||
pip install scikit-image &&\ | ||
mkdir build && cd build && \ | ||
cmake -DCPU_ONLY=1 -DWITH_PYTHON_LAYER=1 -DUSE_OPENCV=0 .. && \ | ||
make -j"$(nproc)" | ||
|
||
# Set up Caffe environment variables | ||
ENV CAFFE_ROOT=/root/caffe | ||
ENV PYCAFFE_ROOT=$CAFFE_ROOT/python | ||
ENV PYTHONPATH=$PYCAFFE_ROOT:$PYTHONPATH \ | ||
PATH=$CAFFE_ROOT/build/tools:$PYCAFFE_ROOT:$PATH | ||
|
||
RUN echo "$CAFFE_ROOT/build/lib" >> /etc/ld.so.conf.d/caffe.conf && ldconfig | ||
|
||
# Install Tensorflow | ||
RUN pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.1-cp27-none-linux_x86_64.whl | ||
|
||
# Install Keras | ||
RUN pip install git+https://github.com/fchollet/keras.git | ||
|
||
# Install Fabrik dependencies | ||
COPY /requirements /code/requirements | ||
RUN pip install -r requirements/common.txt | ||
|
||
COPY . /code | ||
|
||
EXPOSE 8000 | ||
CMD ["/bin/bash", "/code/docker/prod/container-start.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
cd /code && \ | ||
webpack | ||
python manage.py runserver 0.0.0.0:8000 |