Skip to content

Commit d99a83b

Browse files
authored
Merge pull request #368 from telefonicaid/recover-distroless-image
FIX recover distroless image
2 parents ea10fa1 + 2e60107 commit d99a83b

3 files changed

Lines changed: 35 additions & 38 deletions

File tree

docker/Dockerfile

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -155,35 +155,34 @@ RUN sed -i -r "/^(root|nobody)/!d" /etc/passwd /etc/shadow /etc/group \
155155
# - IOTA_AUTH_USER, IOTA_AUTH_PASSWORD - when using Keystone Security
156156
# - IOTA_AUTH_CLIENT_ID, IOTA_AUTH_CLIENT_SECRET - when using OAuth2 Security
157157
#
158-
# FIXME: distroless stuff disabled. See https://github.com/telefonicaid/iotagent-json/issues/891
159-
#
160158
########################################################################################
161-
#FROM gcr.io/distroless/nodejs:${NODE_VERSION} AS distroless
162-
#ARG GITHUB_ACCOUNT
163-
#ARG GITHUB_REPOSITORY
164-
#ARG NODE_VERSION
165-
#
166-
#LABEL "maintainer"="FIWARE IoTAgent Team. Telefónica I+D"
167-
#LABEL "org.opencontainers.image.authors"="iot_support@tid.es"
168-
#LABEL "org.opencontainers.image.documentation"="https://github.com/telefonicaid/iotagent-manager/blob/master/README.md"
169-
#LABEL "org.opencontainers.image.vendor"="Telefónica Investigación y Desarrollo, S.A.U"
170-
#LABEL "org.opencontainers.image.licenses"="AGPL-3.0-only"
171-
#LABEL "org.opencontainers.image.title"="FIWARE IoT Agent Manager (Distroless)"
172-
#LABEL "org.opencontainers.image.description"="The IoT Agent Manager works as a proxy for scenarios where multiple IoT Agents offer different southbound protocols. The IoTA Manager appears as a single administration endpoint for provisioning tasks, redirecting provisioning requests to the appropriate IoTAgent based on the declared protocol."
173-
#LABEL "org.opencontainers.image.source"="https://github.com/${GITHUB_ACCOUNT}/${GITHUB_REPOSITORY}"
174-
#LABEL "org.nodejs.version"="${NODE_VERSION}"
175-
#
176-
#COPY --from=builder /opt/iotaManager /opt/iotaManager
177-
#COPY --from=anon-user /etc/passwd /etc/shadow /etc/group /etc/
178-
#WORKDIR /opt/iotaManager
179-
#
180-
#USER nobody
181-
#ENV NODE_ENV=production
182-
## Expose 8082 for IOTA_SERVER_PORT
183-
#EXPOSE ${IOTA_SERVER_PORT:-8082}
184-
#CMD ["./bin/iota-manager", "-- ", "config.js"]
185-
#HEALTHCHECK --interval=30s --timeout=3s --start-period=10s \
186-
# CMD ["/nodejs/bin/node", "./bin/healthcheck"]
159+
# hadolint ignore=DL3006,DL3007
160+
FROM gcr.io/distroless/nodejs${NODE_VERSION}-debian12 AS distroless
161+
ARG GITHUB_ACCOUNT
162+
ARG GITHUB_REPOSITORY
163+
ARG NODE_VERSION
164+
165+
LABEL "maintainer"="FIWARE IoTAgent Team. Telefónica I+D"
166+
LABEL "org.opencontainers.image.authors"="iot_support@tid.es"
167+
LABEL "org.opencontainers.image.documentation"="https://github.com/telefonicaid/iotagent-manager/blob/master/README.md"
168+
LABEL "org.opencontainers.image.vendor"="Telefónica Investigación y Desarrollo, S.A.U"
169+
LABEL "org.opencontainers.image.licenses"="AGPL-3.0-only"
170+
LABEL "org.opencontainers.image.title"="FIWARE IoT Agent Manager (Distroless)"
171+
LABEL "org.opencontainers.image.description"="The IoT Agent Manager works as a proxy for scenarios where multiple IoT Agents offer different southbound protocols. The IoTA Manager appears as a single administration endpoint for provisioning tasks, redirecting provisioning requests to the appropriate IoTAgent based on the declared protocol."
172+
LABEL "org.opencontainers.image.source"="https://github.com/${GITHUB_ACCOUNT}/${GITHUB_REPOSITORY}"
173+
LABEL "org.nodejs.version"="${NODE_VERSION}"
174+
175+
COPY --from=builder /opt/iotaManager /opt/iotaManager
176+
COPY --from=anon-user /etc/passwd /etc/shadow /etc/group /etc/
177+
WORKDIR /opt/iotaManager
178+
179+
USER nobody
180+
ENV NODE_ENV=production
181+
# Expose 8082 for IOTA_SERVER_PORT
182+
EXPOSE ${IOTA_SERVER_PORT:-8082}
183+
CMD ["./bin/iota-manager", "-- ", "config.js"]
184+
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s \
185+
CMD ["/nodejs/bin/node", "./bin/healthcheck"]
187186

188187

189188
########################################################################################

docker/hooks/build

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,12 @@ docker image build --build-arg SOURCE_BRANCH=$SOURCE_BRANCH \
3535
-t $IMAGE_NAME \
3636
.
3737

38-
# FIXME: distroless stuff disabled. See https://github.com/telefonicaid/iotagent-json/issues/891
39-
#docker image build --build-arg SOURCE_BRANCH=$SOURCE_BRANCH \
40-
# --label "org.opencontainers.image.created"=$(date +%Y-%m-%d) \
41-
# --label "org.opencontainers.image.revision"=$SOURCE_COMMIT \
42-
# --label "org.opencontainers.image.version"=$DOCKER_TAG \
43-
# --target=distroless \
44-
# -t $IMAGE_NAME-distroless \
45-
# .
38+
docker image build --build-arg SOURCE_BRANCH=$SOURCE_BRANCH \
39+
--label "org.opencontainers.image.created"=$(date +%Y-%m-%d) \
40+
--label "org.opencontainers.image.revision"=$SOURCE_COMMIT \
41+
--label "org.opencontainers.image.version"=$DOCKER_TAG \
42+
--target=distroless \
43+
-t $IMAGE_NAME-distroless \
44+
.
4645

4746

docker/hooks/post_push

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
# Not every repository needs hooks, only the ones that needs special tunning. Standard
2929
# dockerhub autobuild works well most of the times.
3030

31-
# FIXME: distroless stuff disabled. See https://github.com/telefonicaid/iotagent-json/issues/891
32-
#docker image push $IMAGE_NAME-distroless
31+
docker image push $IMAGE_NAME-distroless
3332

3433

0 commit comments

Comments
 (0)