Skip to content

Instantly share code, notes, and snippets.

@tempusfrangit
Last active September 10, 2018 23:25
Show Gist options
  • Save tempusfrangit/ab9fd86abfbced49fdb14ea15736aafc to your computer and use it in GitHub Desktop.
Save tempusfrangit/ab9fd86abfbced49fdb14ea15736aafc to your computer and use it in GitHub Desktop.
Keystone Docker Dev

Steps (unit tests)

  1. Install Docker CE for your platform
  2. Create Work Directory
  3. Download Docker File (from this GIST) into the work directory
  4. git clone keystone ( git clone https://git.openstack.org/openstack/keystone ) or other openstack project
  5. build the docker container
    1. If the project is not Keystone, or the downloaded directory is different than 'keystone' in your working direcytory, set OS_PROJECT environment variable to the name of the project directory
    2. Run: docker build . --force-rm -t keystone-dev:16.04 (name the tag appropriate to the project name)
  6. Develop code in the cloned directory
  7. Run unit tests in the docker container
    1. cd ${OS_PROJECT:-keystone} (if needed)
    2. docker run -v `pwd`:/opt/src --rm -t keystone-dev:16.04 tox -epep8,py27,py35 -- NOTE you may pass arguments such as -- --failing for repeated runs and cleaning up failed tests

If you change/update/modify the requirements.txt or test-requirements.txt, you will need to re-run the docker build command from your work directory.

Steps (PyCharm Remote Interpreter)

  1. TBD (needs screen shots)
FROM ubuntu:16.04
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get -yq dist-upgrade
RUN DEBIAN_FRONTEND=noninteractive apt-get install -yq curl python3-dev python-software-properties curl apt-transport-https build-essential git
RUN curl https://bootstrap.pypa.io/get-pip.py | python3
RUN pip install bindep
RUN pip install tox
ADD ./${OS_PROJECT:-keystone}/bindep.txt /opt/bindep.txt
ADD ./${OS_PROJECT:-keystone}/requirements.txt /opt/requirements.txt
ADD ./${OS_PROJECT:-keystone}/test-requirements.txt /opt/test-requirements.txt
RUN DEBIAN_FRONTEND=noninteractive apt-get install -yq `/usr/local/bin/bindep -b --file /opt/bindep.txt | tr '\n' ' '`
RUN pip install -U -r /opt/requirements.txt -r /opt/test-requirements.txt
WORKDIR /opt/src
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment