Skip to content

Commit aedebac

Browse files
Merge pull request #6818 from bandi13/containerReadme
Container readme
2 parents 0571040 + 005346d commit aedebac

3 files changed

Lines changed: 30 additions & 7 deletions

File tree

Docker/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@ This is a Docker environment for compiling, testing and running WolfSSL. Use `ru
33

44
When the compilation and tests succeed, you will be dropped in to a shell environment within the container. This can be useful to build other things within the environment. Additional tests can be run as well as debugging of code.
55

6+
# Docker Hub
7+
These images are also uploaded to the wolfSSL's [Docker Hub page](https://hub.docker.com/orgs/wolfssl/repositories). There is a convenience script here `buildAndPush.sh` that will create the appropriate containers and push them to the repo.
8+
69
# FAQ
710
## permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock
811
You need to be added to the `docker` group to run Docker containers. Run `sudo usermod -aG docker $USER`. You may need to restart the Docker daemon.
912

1013
## Unable to access symlinked files outside of WolfSSL
1114
The volume mounted in the Docker container needs to have all files that your compilation will need. To solve this, you have a couple options:
1215
1. Change the `WOLFSSL_DIR` variable in the `run.sh` to one higher up (by adding `/..` to the path). Then update the `docker build` to include the correct path to the Dockerfile and the `docker run` argument to the working directory (`-w`) to the WolfSSL source directory
13-
2. Move the external repository to within the WolfSSL directory. For example create an `external` folder which has your files. This route may have complications when stashing Git work.
16+
2. Move the external repository to within the WolfSSL directory. For example create an `external` folder which has your files. This route may have complications when stashing Git work.

Docker/buildAndPush.sh

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,37 @@
11
#!/bin/bash
22

3+
# Assume we're in wolfssl/Docker
4+
WOLFSSL_DIR=$(builtin cd ${BASH_SOURCE%/*}/..; pwd)
5+
36
DOCKER_BUILD_OPTIONS="$1"
47
if [ "${DOCKER_BASE_IMAGE}" != "" ]; then
58
DOCKER_BUILD_OPTIONS+=" --build-arg DOCKER_BASE_IMAGE=${DOCKER_BASE_IMAGE}"
69
fi
710

11+
NUM_FAILURES=0
12+
813
CUR_DATE=$(date -u +%F)
914
echo "Building wolfssl/wolfssl-builder:${CUR_DATE} as ${DOCKER_BUILD_OPTIONS}"
1015
docker build -t wolfssl/wolfssl-builder:${CUR_DATE} ${DOCKER_BUILD_OPTIONS} "${WOLFSSL_DIR}/Docker" && \
11-
docker push wolfssl/wolfssl-builder:${CUR_DATE} && \
1216
docker tag wolfssl/wolfssl-builder:${CUR_DATE} wolfssl/wolfssl-builder:latest && \
13-
docker push wolfssl/wolfssl-builder:latest && \
1417
docker build --build-arg DOCKER_BASE_IMAGE=wolfssl/wolfssl-builder:${CUR_DATE} -t wolfssl/testing-cross-compiler:${CUR_DATE} "${WOLFSSL_DIR}/Docker" -f Dockerfile.cross-compiler && \
15-
docker push wolfssl/testing-cross-compiler:${CUR_DATE} && \
16-
docker tag wolfssl/testing-cross-compiler:${CUR_DATE} wolfssl/testing-cross-compiler:latest && \
17-
docker push wolfssl/testing-cross-compiler:latest
18+
docker tag wolfssl/testing-cross-compiler:${CUR_DATE} wolfssl/testing-cross-compiler:latest
19+
20+
if [ $? -eq 0 ]; then
21+
echo "Pushing containers to DockerHub"
22+
docker push wolfssl/wolfssl-builder:${CUR_DATE} && docker push wolfssl/wolfssl-builder:latest && \
23+
docker push wolfssl/testing-cross-compiler:${CUR_DATE} && docker push wolfssl/testing-cross-compiler:latest
24+
else
25+
echo "Warning: Build wolfssl/wolfssl-builder failed. Continuing"
26+
((NUM_FAILURES++))
27+
fi
28+
29+
echo "Building wolfssl/wolfCLU:${CUR_DATE}"
30+
docker buildx build --pull --push --build-arg DUMMY=${CUR_DATE} -t wolfssl/wolfclu:${CUR_DATE} --platform=linux/amd64,linux/arm64,linux/arm/v7 "${WOLFSSL_DIR}/Docker/wolfCLU" && \
31+
docker buildx build --pull --push --build-arg DUMMY=${CUR_DATE} -t wolfssl/wolfclu:latest --platform=linux/amd64,linux/arm64,linux/arm/v7 "${WOLFSSL_DIR}/Docker/wolfCLU"
32+
if [ $? -ne 0 ]; then
33+
echo "Warning: Build wolfssl/wolfclu failed. Continuing"
34+
((NUM_FAILURES++))
35+
fi
36+
37+
echo "Script completed in $SECONDS seconds. Had $NUM_FAILURES failures."

Docker/wolfCLU/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ USER root
2121
COPY --from=BUILDER /usr/local/lib/libwolfssl.so /usr/local/lib/
2222
COPY --from=BUILDER /usr/local/bin/wolfssl* /usr/local/bin/
2323
RUN ldconfig
24-
CMD ["/usr/local/bin/wolfssl"]
24+
ENTRYPOINT ["/usr/local/bin/wolfssl"]
2525
LABEL org.opencontainers.image.source=https://github.com/wolfssl/wolfssl
2626
LABEL org.opencontainers.image.description="Simple wolfCLU in a container"

0 commit comments

Comments
 (0)