Browse Source

fix(docker): Move Docker files into separate directory and fix Docker Cloud build

Stefan Profanter 4 years ago
parent
commit
c5d7624115
4 changed files with 30 additions and 3 deletions
  1. 6 0
      README.md
  2. 4 2
      Dockerfile
  3. 19 0
      docker/README.md
  4. 1 1
      tools/travis/travis_linux_script.sh

+ 6 - 0
README.md

@@ -122,6 +122,12 @@ Jointly with the overall open62541 community, the core maintainers steer the lon
 - Julius Pfrommer (Fraunhofer IOSB, Karlsruhe)
 - Stefan Profanter (fortiss, Munich)
 
+### Docker container
+
+Official docker container builds are available on [Docker Cloud](https://cloud.docker.com/u/open62541/repository/registry-1.docker.io/open62541/open62541)
+
+More information can be found in the [Docker README](docker/README.md)
+
 ## Support & Development
 
 ### Commercial Support

+ 4 - 2
Dockerfile

@@ -5,8 +5,10 @@ ADD . /opt/open62541
 # Get all the git tags to make sure we detect the correct version with git describe
 WORKDIR /opt/open62541
 RUN git remote add github-upstream https://github.com/open62541/open62541.git
-RUN git fetch --tags github-upstream
-RUN git submodule update --init --recursive
+RUN git fetch -f --tags github-upstream
+# Ignore error here. This always fails on Docker Cloud. It's fine there because the submodule is alread initialized. See also:
+# https://stackoverflow.com/questions/58690455/how-to-correctly-initialize-git-submodules-in-dockerfile-for-docker-cloud
+RUN git submodule update --init --recursive || true
 
 WORKDIR /opt/open62541/build
 RUN cmake -DBUILD_SHARED_LIBS=ON \

+ 19 - 0
docker/README.md

@@ -0,0 +1,19 @@
+# open62541 Docker Build
+
+Official docker container builds are available on [Docker Cloud](https://cloud.docker.com/u/open62541/repository/registry-1.docker.io/open62541/open62541)
+
+The container includes the source code itself under `/opt/open62541` and prebuilt examples in `/opt/open62541/build/bin/examples/`.
+
+You can use this container as a basis for your own application. 
+
+Just starting the docker container will start the `server_ctt` example.
+
+## Build locally
+
+To build the container locally use:
+
+```bash
+git clone https://github.com/open62541/open62541
+cd open62541
+docker build -f docker/Dockerfile .
+```

+ 1 - 1
tools/travis/travis_linux_script.sh

@@ -27,7 +27,7 @@ fi
 
 # Docker build test
 if ! [ -z ${DOCKER+x} ]; then
-    docker build -t open62541 .
+    docker build -t open62541 -f docker/Dockerfile .
     docker run -d -p 127.0.0.1:4840:4840 --name open62541 open62541 /bin/sh
     docker ps | grep -q open62541
     # disabled since it randomly fails