Skip to content

Commit f91ab7c

Browse files
committed
<build>(docker): refactor our dockerfile according to best practice
1 parent 2f237ef commit f91ab7c

File tree

1 file changed

+35
-29
lines changed

1 file changed

+35
-29
lines changed

docker/Dockerfile

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,41 @@ LABEL maintainer="[email protected]"
55
LABEL project="Berrynet"
66
LABEL version="3.7.0"
77

8-
# Update apt
9-
RUN apt-get update
10-
11-
# Install dependencies
12-
RUN apt-get install -y git sudo wget lsb-release software-properties-common
13-
14-
# Install build-essential
15-
RUN apt-get install -y build-essential curl
16-
17-
# Install systemd
18-
RUN apt-get install -y systemd systemd-sysv
8+
ENV POETRY_VIRTUALENVS_CREATE=false \
9+
POETRY_CACHE_DIR='/var/cache/pypoetry'
1910

20-
# Install python
21-
RUN apt-get install -y python3 python3-dev
22-
23-
# Install python libs
24-
RUN apt-get install -y python3-wheel python3-setuptools python3-pip
25-
RUN apt-get install -y python3-paho-mqtt python3-logzero python3-astor
26-
RUN apt-get install -y python3-opengl python3-six python3-grpcio
27-
RUN apt-get install -y python3-keras-applications python3-keras-preprocessing
28-
RUN apt-get install -y python3-protobuf python3-termcolor python3-numpy
29-
30-
# Install daemons
31-
RUN apt-get install -y mosquitto mosquitto-clients
32-
RUN apt-get install -y apache2
33-
34-
# Install tensorflow
35-
RUN pip3 install tensorflow
11+
# Update apt
12+
RUN apt-get update \
13+
# Install dependencies
14+
&& apt-get install -y --no-install-recommends git wget lsb-release software-properties-common \
15+
# Install build-essential
16+
build-essential curl \
17+
# Install systemd
18+
systemd systemd-sysv \
19+
# Install python
20+
python3 python3-dev \
21+
# Install python libs
22+
python3-wheel python3-setuptools python3-pip \
23+
python3-paho-mqtt python3-logzero python3-astor \
24+
python3-opengl python3-six python3-grpcio \
25+
python3-keras-applications python3-keras-preprocessing \
26+
python3-protobuf python3-termcolor python3-numpy \
27+
# Install daemons
28+
mosquitto mosquitto-clients \
29+
apache2
30+
31+
# Install python dependencies
32+
WORKDIR /app
33+
COPY poetry.lock poetry.lock
34+
COPY pyproject.toml pyproject.toml
35+
36+
RUN pip install --no-cache-dir poetry \
37+
&& poetry install --no-interaction --no-ansi --no-dev \
38+
# Cleaning poetry installation's cache for production:
39+
&& rm -rf "$POETRY_CACHE_DIR" \
40+
&& pip uninstall -yq poetry
3641

3742
# Install BerryNet
38-
RUN git clone https://github.com/DT42/BerryNet.git
39-
RUN cd BerryNet; ./configure
43+
WORKDIR /app/BerryNet
44+
COPY . .
45+
RUN ./configure

0 commit comments

Comments
 (0)