not replacing system libs in docker image (#49)

* not replacing system libs in docker image

* push image only when on main branch (after PR is merged)

* add permanent id to image
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 691522f..9a61b7d 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -103,10 +103,18 @@
           name: Test docker image
           command: |
             docker run -e SHORT_TEST="Yes" oqs-python
-      - run:
-          name: Push docker image
-          command: |
-            docker tag oqs-python $TARGETNAME/python:latest && docker push $TARGETNAME/python:latest
+      - when:
+          condition:
+            equal: [ main, << pipeline.git.branch >> ]
+          steps:
+            - run:
+                name: Push docker image
+                command: |
+                   export SHORT_GITID=`git rev-parse --short HEAD`
+                   docker tag oqs-python $TARGETNAME/python:latest && \
+                   docker push $TARGETNAME/python:latest && \
+                   docker tag oqs-python $TARGETNAME/python:$SHORT_GITID && \
+                   docker push $TARGETNAME/python:$SHORT_GITID
 
 workflows:
   build:
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 0bc9191..4409582 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -32,7 +32,7 @@
 WORKDIR /opt
 RUN git clone --depth 1 --branch OQS-OpenSSL_1_1_1-stable https://github.com/open-quantum-safe/openssl.git && cd liboqs && mkdir build-openssl && cd build-openssl && cmake -G"Ninja" .. ${LIBOQS_BUILD_DEFINES} -DCMAKE_INSTALL_PREFIX=/opt/openssl/oqs && ninja install
 
-RUN apk add automake autoconf && cd /opt/openssl && LDFLAGS="-Wl,-rpath -Wl,/usr/local/lib" ./Configure shared linux-x86_64 -lm && make ${MAKE_DEFINES} && make install_sw
+RUN apk add automake autoconf && cd /opt/openssl && LDFLAGS="-Wl,-rpath -Wl,/usr/local/lib64" ./Configure shared linux-x86_64 -lm && make ${MAKE_DEFINES} && make install_sw
 
 # Get LetsEncrypt root
 RUN wget https://letsencrypt.org/certs/isrgrootx1.pem
@@ -47,9 +47,6 @@
 COPY --from=intermediate /usr/local /usr/local
 COPY --from=intermediate /opt/liboqs-python /opt/liboqs-python
 
-# Replace standard OpenSSL libs:
-RUN rm /lib/libssl.so.1.1 /lib/libcrypto.so.1.1 && ln -s /usr/local/lib64/libcrypto.so.1.1 /lib && ln -s /usr/local/lib64/libssl.so.1.1 /lib && ln -s /usr/local/lib64/liboqs.so /lib && ln -s /usr/local/lib64/liboqs.so.0 /lib
-
 ENV PYTHONPATH=/opt/liboqs-python
 
 # Enable a normal user 
@@ -60,4 +57,6 @@
 COPY minitest.py /home/oqs/minitest.py
 COPY --from=intermediate /opt/isrgrootx1.pem /home/oqs/isrgrootx1.pem
 
+# ensure oqs libs are found. Unset if interested in using stock openssl:
+ENV LD_LIBRARY_PATH=/usr/local/lib64
 CMD ["python3", "minitest.py"]