-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
39 lines (30 loc) · 1.52 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
FROM conanio/gcc7
LABEL maintainer="Rodrigo Broggi <[email protected]>"
# Run as non-root
USER conan
WORKDIR /home/conan
# Copy current directory to the image/container as conan user
COPY --chown=conan:1001 . pocoLibExamples/
RUN mkdir -p /home/conan/.conan/profiles && \
printf "[settings]\nos=Linux\nos_build=Linux\narch=x86_64\narch_build=x86_64\ncompiler=gcc\ncompiler.version=7\ncompiler.libcxx=libstdc++11\nbuild_type=Release\n[options]\n[build_requires]\n[env]\n" > /home/conan/.conan/profiles/default
# Building Binary
RUN cd /home/conan/pocoLibExamples && \
pip install conan --upgrade && \
conan profile update settings.compiler.libcxx=libstdc++11 default && \
conan install ./ -if ./build --build=missing && \
cmake -G "Unix Makefiles" ./ -B./build && \
cd build && \
make
# Generate RSA key for testing
RUN cd /home/conan/pocoLibExamples/build && \
openssl genrsa -passout pass:foobar -des3 -out private.pem 2048 && \
openssl rsa -in private.pem -passin pass:foobar -outform PEM -pubout -out public.pem
# Run some tests
RUN cd /home/conan/pocoLibExamples/build && \
./bin/poco_lib hash SHA256 hex "pocoLibExamples"
# Run dec/enc
RUN cd /home/conan/pocoLibExamples/build && \
./bin/poco_lib dec ./private.pem "foobar" hex "$(./bin/poco_lib enc ./public.pem hex "pocoLibExample")"
# Run verify/sign
RUN cd /home/conan/pocoLibExamples/build && \
./bin/poco_lib verify SHA256 ./public.pem "$(./bin/poco_lib sign SHA256 ./private.pem foobar hex "pocoLibExamples")" hex "pocoLibExamples"