Skip to content

Commit

Permalink
<build>(docker): refactor our dockerfile according to best practice
Browse files Browse the repository at this point in the history
  • Loading branch information
david30907d committed Aug 6, 2020
1 parent 2f237ef commit 0d9386f
Show file tree
Hide file tree
Showing 4 changed files with 318 additions and 369 deletions.
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
__pycache__
.mypy_cache
.pytest_cache
.vscode
bower_components
venv
node_modules
.git
.github
64 changes: 35 additions & 29 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,41 @@ LABEL maintainer="dev@dt42.io"
LABEL project="Berrynet"
LABEL version="3.7.0"

# Update apt
RUN apt-get update

# Install dependencies
RUN apt-get install -y git sudo wget lsb-release software-properties-common

# Install build-essential
RUN apt-get install -y build-essential curl

# Install systemd
RUN apt-get install -y systemd systemd-sysv
ENV POETRY_VIRTUALENVS_CREATE=false \
POETRY_CACHE_DIR='/var/cache/pypoetry'

# Install python
RUN apt-get install -y python3 python3-dev

# Install python libs
RUN apt-get install -y python3-wheel python3-setuptools python3-pip
RUN apt-get install -y python3-paho-mqtt python3-logzero python3-astor
RUN apt-get install -y python3-opengl python3-six python3-grpcio
RUN apt-get install -y python3-keras-applications python3-keras-preprocessing
RUN apt-get install -y python3-protobuf python3-termcolor python3-numpy

# Install daemons
RUN apt-get install -y mosquitto mosquitto-clients
RUN apt-get install -y apache2

# Install tensorflow
RUN pip3 install tensorflow
# Update apt
RUN apt-get update \
# Install dependencies
&& apt-get install -y --no-install-recommends git wget lsb-release software-properties-common \
# Install build-essential
build-essential curl \
# Install systemd
systemd systemd-sysv \
# Install python
python3 python3-dev \
# Install python libs
python3-wheel python3-setuptools python3-pip \
python3-paho-mqtt python3-logzero python3-astor \
python3-opengl python3-six python3-grpcio \
python3-keras-applications python3-keras-preprocessing \
python3-protobuf python3-termcolor python3-numpy \
# Install daemons
mosquitto mosquitto-clients \
apache2

# Install python dependencies
WORKDIR /app
COPY poetry.lock poetry.lock
COPY pyproject.toml pyproject.toml

RUN pip3 install --no-cache-dir poetry \
&& poetry install --no-interaction --no-ansi --no-dev \
# Cleaning poetry installation's cache for production:
&& rm -rf "$POETRY_CACHE_DIR" \
&& pip3 uninstall -yq poetry

# Install BerryNet
RUN git clone https://github.com/DT42/BerryNet.git
RUN cd BerryNet; ./configure
WORKDIR /app/BerryNet
COPY . .
RUN ./configure
Loading

0 comments on commit 0d9386f

Please sign in to comment.