reworked docker layout

pull/826/head
Damon C 2019-03-28 15:41:45 -07:00
parent 7584aea141
commit 655eb3a2cc
5 changed files with 30 additions and 24 deletions

View File

@ -9,8 +9,6 @@ services:
nucypher-dev:
volumes:
- ../..:/code
ports:
- 11500
build:
context: ../..
dockerfile: dev/docker/Dockerfile
@ -20,7 +18,7 @@ services:
volumes:
- ../..:/code
ports:
- 11500
- 11501:11500
image: dev:nucypher
command: nucypher ursula run --dev --federated-only --rest-host 172.28.1.1 --rest-port 11500
networks:
@ -31,7 +29,7 @@ services:
volumes:
- ../..:/code
ports:
- 11500
- 11502:11500
image: dev:nucypher
depends_on:
- ursula1
@ -44,7 +42,7 @@ services:
volumes:
- ../..:/code
ports:
- 11500
- 11503:11500
image: dev:nucypher
depends_on:
- ursula1

View File

@ -1,21 +1,29 @@
FROM python:3.7.0
ENV PYTHONUNBUFFERED 1
ENV PYTHONPATH /code
# Update
RUN apt-get update -y && apt-get upgrade -y && apt-get install gcc libffi-dev wget git -y
EXPOSE 11500
# make an install directory
RUN mkdir /install
# add local files needed for install
RUN mkdir /code
WORKDIR /code
ADD dev-requirements.txt /code/dev-requirements.txt
ADD ./scripts/installation/install_solc.sh /code/install_solc.sh
# copy only the exact files needed for install into the container
COPY ./nucypher/__about__.py /install/nucypher/
COPY README.md /install
COPY setup.py /install
COPY scripts/installation/install_solc.sh /install
COPY dev-requirements.txt /install
COPY requirements.txt /install
COPY dev/docker/scripts/install/entrypoint.sh /install
# install reqs and solc
RUN pip install --upgrade pip \
&& pip3 install -r dev-requirements.txt --src /usr/local/src \
&& ./install_solc.sh
RUN pip install --upgrade pip
RUN pip3 install -r /install/dev-requirements.txt --src /usr/local/src
RUN /install/install_solc.sh
# finish install with some local volume ops
CMD ["./dev/docker/scripts/install/entrypoint.sh"]
# puts the nucypher executable in bin path
RUN python /install/setup.py develop
# this gets called after volumes are mounted and so can modify the local disk
CMD ["/install/entrypoint.sh"]

View File

@ -12,11 +12,11 @@ The intention of the Docker configurations in this directory is to enable anyone
Then you can do things like:
* run the tests:
`docker run -it dev:nucypher pytest`
`docker-compose run nucypher-dev pytest`
* start up an ursula:
`docker run -it -p 10151:10151 dev:nucypher nucypher ursula run --dev --federated-only`
`docker-compose run nucypher-dev nucypher ursula run --dev --federated-only`
* open a shell:
`docker run -it dev:nucypher bash`
`docker-compose run nucypher-dev bash`
* try some of the scripts in `dev/docker/scripts/`

View File

@ -5,9 +5,10 @@ services:
volumes:
- ../..:/code
ports:
- 11500
- 10151:10151
build:
context: ../..
dockerfile: dev/docker/Dockerfile
image: dev:nucypher
container_name: nucypher-dev
working_dir: /code

View File

@ -1,11 +1,10 @@
#!/bin/bash
# runs inside docker container with access to local volume.
# this is needed for local development
# so that the local repository is accessed
# by shared volume and is executable by 'nucypher' cli
# needed for local development, creates nucypher.egg-info on local disk
# if it doesn't exist.
if [ ! -e /code/nucypher.egg-info ]; then
echo "First time install..."
pip3 install -e .
python setup.py develop
fi