1+ #
2+ # Copyright 2019 Atos Spain S.A
3+ #
4+ # This file is part of iotagent-lora
5+ #
6+ # iotagent-lora is free software: you can redistribute it and/or
7+ # modify it under the terms of the GNU Affero General Public License as
8+ # published by the Free Software Foundation, either version 3 of the License,
9+ # or (at your option) any later version.
10+ #
11+ # iotagent-lora is distributed in the hope that it will be useful,
12+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14+ # See the GNU Affero General Public License for more details.
15+ #
16+ # You should have received a copy of the GNU Affero General Public
17+ # License along with iotagent-lora. If not, see http://www.gnu.org/licenses/.
18+ #
19+
120ARG NODE_VERSION=8.15.0-slim
221FROM node:${NODE_VERSION}
322ARG GITHUB_ACCOUNT=Atos-Research-and-Innovation
423ARG GITHUB_REPOSITORY=IoTagent-LoRaWAN
524ARG DOWNLOAD=latest
25+ ARG SOURCE_BRANCH=master
626
727# Copying Build time arguments to environment variables so they are persisted at run time and can be
828# inspected within a running container.
@@ -14,6 +34,12 @@ ENV DOWNLOAD=${DOWNLOAD}
1434
1535MAINTAINER FIWARE IoTAgent Team. Atos Spain S.A
1636
37+ # IMPORTANT: For production environments use Docker Secrets to protect values of the sensitive ENV
38+ # variables defined below, by adding _FILE to the name of the relevant variable.
39+ #
40+ # - IOTA_AUTH_USER, IOTA_AUTH_PASSWORD - when using Keystone Security
41+ # - IOTA_AUTH_CLIENT_ID, IOTA_AUTH_CLIENT_SECRET - when using OAuth2 Security
42+
1743#
1844# The following RUN command retrieves the source code from GitHub.
1945#
@@ -31,8 +57,8 @@ MAINTAINER FIWARE IoTAgent Team. Atos Spain S.A
3157#
3258RUN if [ "${DOWNLOAD}" = "latest" ] ; \
3359 then \
34- RELEASE="master " ; \
35- echo "INFO: Building Latest Development" ; \
60+ RELEASE="${SOURCE_BRANCH} " ; \
61+ echo "INFO: Building Latest Development from ${SOURCE_BRANCH} branch. " ; \
3662 elif [ "${DOWNLOAD}" = "stable" ]; \
3763 then \
3864 RELEASE=$(curl -s https://api.github.com/repos/"${GITHUB_ACCOUNT}" /"${GITHUB_REPOSITORY}" /releases/latest | grep 'tag_name' | cut -d\" -f4); \
@@ -41,13 +67,14 @@ RUN if [ "${DOWNLOAD}" = "latest" ] ; \
4167 RELEASE="${DOWNLOAD}" ; \
4268 echo "INFO: Building Release: ${RELEASE}" ; \
4369 fi && \
70+ RELEASE_CONCAT=$(echo "${RELEASE}" | tr / -); \
4471 # Ensure that unzip is installed, and download the sources
4572 apt-get update && \
4673 apt-get install -y --no-install-recommends unzip && \
4774 wget --no-check-certificate -O source.zip https://github.com/"${GITHUB_ACCOUNT}" /"${GITHUB_REPOSITORY}" /archive/"${RELEASE}" .zip && \
4875 unzip source.zip && \
4976 rm source.zip && \
50- mv "${GITHUB_REPOSITORY}-${RELEASE }" /opt/iotagent-lora && \
77+ mv "${GITHUB_REPOSITORY}-${RELEASE_CONCAT }" /opt/iotagent-lora && \
5178 # Remove unzip and clean apt cache
5279 apt-get clean && \
5380 apt-get remove -y unzip && \
@@ -65,13 +92,14 @@ RUN \
6592 # Remove Git and clean apt cache
6693 apt-get clean && \
6794 apt-get remove -y git && \
68- apt-get -y autoremove
95+ apt-get -y autoremove && \
96+ chmod +x docker/entrypoint.sh
6997
7098USER node
7199ENV NODE_ENV=production
72100
73101# Expose 4041 for NORTH PORT
74102EXPOSE ${IOTA_NORTH_PORT:-4041}
75103
76- ENTRYPOINT ["pm2-runtime" , "bin/iotagent-lora " ]
104+ ENTRYPOINT ["docker/entrypoint.sh " ]
77105CMD ["-- " , "config.js" ]
0 commit comments