Skip to content

Commit 98ff1f6

Browse files
committed
Adding sudo permission to run FFM plugin tests
1 parent e9ed708 commit 98ff1f6

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

pi4j-builder-2.0/Dockerfile

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ARG BUILDDATE
77
ARG BUILDVERSION
88
MAINTAINER Pi4J "info@pi4j.com"
99

10-
# docker container image labels
10+
# Docker container image labels
1111
LABEL org.label-schema.schema-version="1.0"
1212
LABEL org.label-schema.build-date=$BUILDDATE
1313
LABEL org.label-schema.name="pi4j/pi4j-builder"
@@ -22,9 +22,6 @@ RUN echo "========================================================="
2222
RUN echo " BUILDING DOCKER Pi4J v$BUILDVERSION BUILDER IMAGE FOR: $TARGETARCH"
2323
RUN echo "========================================================="
2424

25-
# Install sudo, needed for FFM plugin tests
26-
RUN apt-get update && apt-get install -y sudo
27-
2825
# ---------------------------------------------------------------------------------
2926
# PROJECT BUILDER IMAGE FOR Pi4J v2.0
3027
# ---------------------------------------------------------------------------------
@@ -38,15 +35,21 @@ RUN cd /pi4j && \
3835
mvn dependency:go-offline -DexcludeGroupIds=com.pi4j -Pnative && \
3936
rm -R /pi4j
4037

41-
# ensure read/write access permissions to the M2 repository cache for all users
38+
# Ensure read/write access permissions to the M2 repository cache for all users
4239
RUN chmod -R a+rw /.m2
4340

44-
# configure environment variables
41+
# Install sudo, needed for FFM plugin tests and
42+
# add sudo permissions for GPIO simulator scripts.
43+
RUN apt-get install -y sudo
44+
RUN echo "ALL ALL=(ALL) NOPASSWD: /build/plugins/pi4j-plugin-ffm/src/test/resources/*" >> /etc/sudoers.d/gpio-simulator
45+
RUN chmod 0440 /etc/sudoers.d/gpio-simulator
46+
47+
# Configure environment variables
4548
ENV PI4J_BUILDER_DATE="$BUILDDATE"
4649
ENV PI4J_BUILDER="$BUILDVERSION"
4750

48-
# always launch Maven to perform the build
51+
# Always launch Maven to perform the build
4952
ENTRYPOINT ["mvn"]
5053

51-
# use these default parameters for the Maven build; can be overridden by caller
54+
# Use these default parameters for the Maven build; can be overridden by caller
5255
CMD ["clean", "install", "-DskipTests", "-Pnative,cross-compile"]

0 commit comments

Comments
 (0)