Dockerfile 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. FROM alpine:3.10
  2. RUN apk add --no-cache cmake gcc git g++ musl-dev mbedtls-dev python py-pip make && rm -rf /var/cache/apk/*
  3. ADD . /opt/open62541
  4. # Get all the git tags to make sure we detect the correct version with git describe
  5. WORKDIR /opt/open62541
  6. RUN git remote add github-upstream https://github.com/open62541/open62541.git
  7. RUN git fetch -f --tags github-upstream
  8. # Ignore error here. This always fails on Docker Cloud. It's fine there because the submodule is alread initialized. See also:
  9. # https://stackoverflow.com/questions/58690455/how-to-correctly-initialize-git-submodules-in-dockerfile-for-docker-cloud
  10. RUN git submodule update --init --recursive || true
  11. WORKDIR /opt/open62541/build
  12. RUN cmake -DBUILD_SHARED_LIBS=ON \
  13. -DCMAKE_BUILD_TYPE=Debug \
  14. -DUA_BUILD_EXAMPLES=ON \
  15. # Hardening needs to be disabled, otherwise the docker build takes too long and travis fails
  16. -DUA_ENABLE_HARDENING=OFF \
  17. -DUA_ENABLE_ENCRYPTION=ON \
  18. -DUA_ENABLE_SUBSCRIPTIONS=ON \
  19. -DUA_ENABLE_SUBSCRIPTIONS_EVENTS=ON \
  20. -DUA_NAMESPACE_ZERO=FULL \
  21. /opt/open62541
  22. RUN make -j
  23. RUN make install
  24. WORKDIR /opt/open62541
  25. # Generate certificates
  26. RUN apk add --no-cache python-dev linux-headers openssl && rm -rf /var/cache/apk/*
  27. RUN pip install netifaces==0.10.9
  28. RUN mkdir -p /opt/open62541/pki/created
  29. RUN python /opt/open62541/tools/certs/create_self-signed.py /opt/open62541/pki/created
  30. EXPOSE 4840
  31. CMD ["/opt/open62541/build/bin/examples/server_ctt" , "/opt/open62541/pki/created/server_cert.der", "/opt/open62541/pki/created/server_key.der", "--enableUnencrypted", "--enableAnonymous"]