Skip to content

Commit ed2ca22

Browse files
author
Eugen Cepoi
committed
Initial version
0 parents  commit ed2ca22

10 files changed

+3747
-0
lines changed

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.git/
2+
.env

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
venv
2+
*.pyc
3+
.env
4+
.idea/

Dockerfile

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
FROM heroku/heroku:16
2+
3+
# Python and Caffe native dependencies
4+
RUN apt-get update && apt-get install -y --no-install-recommends \
5+
build-essential \
6+
cmake \
7+
git \
8+
wget \
9+
libatlas-base-dev \
10+
libboost-all-dev \
11+
libgflags-dev \
12+
libgoogle-glog-dev \
13+
libhdf5-serial-dev \
14+
libleveldb-dev \
15+
liblmdb-dev \
16+
libopencv-dev \
17+
libprotobuf-dev \
18+
libsnappy-dev \
19+
protobuf-compiler \
20+
python-dev \
21+
python-numpy \
22+
python-pip \
23+
python-setuptools \
24+
python-scipy && \
25+
rm -rf /var/lib/apt/lists/*
26+
27+
# Building Caffe
28+
ENV CAFFE_ROOT=/opt/caffe
29+
WORKDIR $CAFFE_ROOT
30+
31+
ENV CLONE_TAG=1.0
32+
33+
RUN git clone -b ${CLONE_TAG} --depth 1 https://github.com/BVLC/caffe.git .
34+
RUN pip install --upgrade pip
35+
RUN pip install -r ./python/requirements.txt
36+
RUN mkdir build && cd build && \
37+
cmake -DCPU_ONLY=1 .. && \
38+
make -j"$(nproc)"
39+
40+
ENV PYCAFFE_ROOT $CAFFE_ROOT/python
41+
ENV PYTHONPATH $PYCAFFE_ROOT:$PYTHONPATH
42+
ENV PATH $CAFFE_ROOT/build/tools:$PYCAFFE_ROOT:$PATH
43+
RUN echo "$CAFFE_ROOT/build/lib" >> /etc/ld.so.conf.d/caffe.conf && ldconfig
44+
45+
46+
#WORKDIR /workspace
47+
48+
# Build and install app dependencies
49+
ADD ./requirements.txt /tmp/requirements.txt
50+
51+
# Install dependencies
52+
RUN pip install --no-cache-dir -q -r /tmp/requirements.txt
53+
RUN pip install --ignore-installed pyOpenSSL --upgrade
54+
55+
# Add our code
56+
ADD ./nsfw_model /opt/nsfw_model
57+
ADD ./web /opt/web/
58+
WORKDIR /opt/web
59+
60+
# Run the app. CMD is required to run on Heroku
61+
# $PORT is set by Heroku
62+
CMD gunicorn --bind 0.0.0.0:$PORT app:app

docker-compose.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: '2'
2+
services:
3+
web:
4+
build: .
5+
ports:
6+
- "5000:5000"
7+
env_file: .env
8+
volumes:
9+
- ./web:/opt/web

0 commit comments

Comments
 (0)