Configuration for Docker

The following example shows a dockerfile configured to install ActivePython and install and configure the Security & Compliance plugin.

  1. Create a new directory for your Docker project. For example: ~/AP35_Docker.
  2. Create a file named dockerfile in this folder and copy in the contents of the Dockerfile example codeblock.
  3. Download and save the Security & Compliance plugin to your Docker project directory.
  4. Create an identity in the ActiveState Platform to store and save the associated activestate.config file in your Docker project directory.
  5. On the command line, switch to the Docker project directory.
  6. Build the Docker image:

    # Remove any intermediate containers that are built and tag (name) the image
    docker build -rm -t activepython-plugin-354 .
    
  7. Run the Docker image:

    # Run the docker image interactively and start with the command prompt
    docker run -it activepython-plugin-354 /bin/bash
    

Dockerfile example

FROM centos:7

RUN yum -y install wget

WORKDIR /var/tmp

RUN wget http://downloads.activestate.com/ActivePython/releases/3.5.4.3504/ActivePython-3.5.4.3504-linux-x86_64-glibc-2.12-404899.tar.gz
RUN tar xf /var/tmp/ActivePython-3.5.4.3504-linux-x86_64-glibc-2.12-404899.tar.gz
WORKDIR /var/tmp/ActivePython-3.5.4.3504-linux-x86_64-glibc-2.12-404899
RUN /bin/ash ./install.sh --install-dir /opt/ActivePython-3.5
RUN echo export PATH=/opt/ActivePython-3.5/bin:\$PATH > /etc/profile.d/pythonpath.sh

RUN rm -rf /var/tmp/ActivePython-3.5.4.3504-linux-x86_64-glibc-2.12-404899.tar.gz
RUN rm -rf /var/tmp/ActivePython-3.5.4.3504-linux-x86_64-glibc-2.12-404899

ENV PATH /opt/ActivePython-3.5/bin:$PATH

RUN cd /usr/local/bin \
    && ln -s /opt/ActivePython-3.5/bin/python3 python \
    && ln -s /opt/ActivePython-3.5/bin/pip3 pip

ENV PYTHONUNBUFFERED 1

COPY ./ActiveState-SecurityScanner-0.5.5.tar.gz /var/tmp
RUN pip install --upgrade pip
RUN pip install /var/tmp/ActiveState-SecurityScanner-0.5.5.tar.gz
COPY ./activestate.config /etc/activestate.config